Example:
exec sp_addextendedproperty 'MS_Description', 'This column is awesome', 'schema', 'dbo', 'table', 'mytable', 'column', 'mycolumn';This adds an extended property called
MS_Description to the column dbo.table.mycolumn.Note:
MS_Descriptionis the standardized name for a short description. Using this helps when auto generating documentation from your database.- You can't add a property if it already exists. In that case, you must specifically update it. See examples for more info.
- If you don't use schemas in your database, then
dbois your current schema.
Examples:
| Action | Command |
|---|---|
| Add description to a procedure | exec sp_addextendedproperty 'MS_Description', 'My super cool procedure', 'schema', 'dbo', 'procedure', 'my_proc'; |
Update existing property version on a table | exec sp_updateextendedproperty 'version', '2.0', 'schema', 'dbo', 'table', 'my_table'; |
Delete existing property version from a table | exec sp_deleteextendedproperty 'version', 'schema', 'dbo', 'table', 'my_table'; |
| List all properties of a column | select * from fn_listextendedproperty(default, 'schema', 'dbo', 'table', 'my_table', 'column', 'my_column'); |
List the MS_Description property of a table | select * from fn_listextendedproperty('MS_Description', 'schema', 'dbo', 'table', 'my_table', null, null); |