Obtains, adds, modifies, and deletes sqlserver field descriptions.
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') AND (c. name = 'vince ') AND (o. name = 'IP _ address ')
OrDER BY o. name
Description of the province field in the ip_address table
-- Create a table and its description
Create table (a1 varchar (10), a2 char (2 ))
-- Add description information for the table
EXECUTE sp_addextendedproperty N 'Ms _ description', 'personnel info table ', N 'user', N 'dbo', N 'table', N 'table', NULL, NULL
-- Add description information for field a1
EXECUTE sp_addextendedproperty N 'Ms _ description', 'name', N 'user', N 'dbo', N 'table', N 'table', N 'column ', N 'a1'
EXECUTE sp_addextendedproperty N 'Ms _ description', 'test', N 'user', N 'dbo', N 'table', N 'hr _ Employees ', N 'column ', N 'test'
-- Add description information for field a2
EXECUTE sp_addextendedproperty N 'Ms _ description', 'gender', N 'user', N 'dbo', N 'table', N 'table', N 'column ', N 'a2'
-- Update the description attribute of column a1 in the table:
EXEC sp_updateextendedproperty 'Ms _ description', 'field 1', 'user', dbo, 'table', 'table', 'column', a1
-- Delete the description attribute of column a1 in the table:
EXEC sp_dropextendedproperty 'Ms _ description', 'user', dbo, 'table', 'table', 'column', a1
-- Delete test
Drop table