MSSQL field addition method.
MSSQL field addition method.
-- Add field description
EXEC sp_addextendedproperty 'Ms _ description', 'description to be added ', 'user', dbo, 'table', table name, 'column', column name
-- Delete field description
EXEC sp_dropextendedproperty 'Ms _ description', 'user', dbo, 'table', table name, 'column ', field name
-- View Field description
The Code is as follows:
SELECT
[Table Name] = I _s.TABLE_NAME,
[Column Name] = I _s.COLUMN_NAME,
[Description] = s. value
FROM
INFORMATION_SCHEMA.COLUMNS I _s
LEFT OUTER JOIN
Sysproperties s
ON
S. id = OBJECT_ID (I _s.TABLE_SCHEMA + '.' + I _s.TABLE_NAME)
AND s. smallid = I _s.ORDINAL_POSITION
AND s. name = 'Ms _ description'
WHERE
OBJECTPROPERTY (OBJECT_ID (I _s.TABLE_SCHEMA + '.' + I _s.TABLE_NAME), 'ismsshipped ') = 0
AND I _s.TABLE_NAME = 'job'
ORDER
I _s.TABLE_NAME, I _s.ORDINAL_POSITION