How to specify a description for a column when creating a table with an SQL statement. The sp_addextendedproperty is used primarily for this stored procedure.
Grammar
|
sp_addextendedproperty [@name =] {' property_name '} [, [@value =] {' V Alue '} [, [@level0type =] {' Level0_object_type '} , [@ Level0name =] {' Level0_object_name '} [, [@level1type =] {' Level1_object_type '} , [@level1name =] {' Level1_object_name '} & nbsp; [, [@level2type =] {' Level2_object_type '}   &NBsp; , [@level2name =] {' level2_ object_name '} ] ] ] ] |
--Create a table
Create TABLE table (A1 varchar), A2 char (2))
--Add descriptive information to the table
EXECUTE sp_addextendedproperty n ' ms_description ', ' Personnel information table ', n ' user ', n ' dbo ', n ' table ', n ' tables ', NULL, NULL
--Add descriptive information for field A1
EXECUTE sp_addextendedproperty n ' ms_description ', ' name ', n ' user ', n ' dbo ', n ' table ', n ' tables ', n ' column ', n ' A1 '
--Add descriptive information for field A2
EXECUTE sp_addextendedproperty n ' ms_description ', ' Gender ', n ' user ', n ' dbo ', n ' table ', n ' tables ', n ' column ', n ' A2 '
--Update the Description property of the column A1 in the table:
EXEC sp_updateextendedproperty ' ms_description ', ' Field 1 ', ' user ', dbo, ' table ', ' table ', ' column ', A1
--Delete The Description property of the column A1 in the table:
EXEC sp_dropextendedproperty ' ms_description ', ' user ', dbo, ' table ', ' Tables ', ' column ', A1
--Delete test
drop table
/**************************************************************************
The above in SQLServer2012 under Pro-Test available
Reprinted from: http://www.cnblogs.com/IcefishBingqing/archive/2010/09/02/1815653.html#undefined
**************************************************************************/