The extended attributes in sqlserver help are described as follows:
The extended properties property sets or retrieves provider-specific connection information that cannot be explicitly described through the property mechanic.
You can perform the following operations on extended attributes:
CopyCode The Code is as follows: exec sp_addextendedproperty n 'Ms _ description', N 'field description', N 'user', N 'dbo ',
N 'table', N 'table name', N 'column ', N 'field name'
Go
For example, exec sp_addextendedproperty n 'Ms _ description', N 'address', N 'user', DBO, N 'table ',Copy codeThe Code is as follows: n 'A', N 'column ', a_add
Go -- my table is a. Add the field description to the field a_add: address.
Others:
Delete:
Copy code The Code is as follows: exec sp_dropextendedproperty n 'Ms _ description', N 'user', DBO, N 'table', N 'table name ',
N 'column ', field name
Modify:Copy codeThe Code is as follows: exec sp_updateextendedproperty n 'Ms _ description', n'field description', n'user ',
DBO, N 'table', N 'table name', 'column ', Field
As for the query, SQL Server provides the system function fn_listextendedproperty ():Copy codeThe Code is as follows: -- get the description of a field
Select *
From: fn_listextendedproperty (null, 'user', 'dbo', 'table', 'table name', 'column ',
Default) -- other variables, you can write as required, as long as the table name is changed to your
Where objname = 'field name'
You can also query the table by yourself: copy Code the code is as follows: Select O. name as tablename, C. name as columnname, P. [value] As description
from sysproperties P inner join
sysobjects o on O. id = P. id inner join
syscolumns C on p. id = C. ID and P. smallid = C. colid
where (P. name = 'Ms _ description')
order by O. name