Friday, August 5, 2011

T-SQL - How to add a Column Description by code

Use sp_addextendedproperty system stored procedure

The following example adds a caption property to column PostalCode in table Address

USE AdventureWorks2008R2;
GO
EXEC sp_addextendedproperty
@name = N'Caption',
@value = 'Postal code is a required column.',
@level0type = N'Schema', @level0name = 'Person',
@level1type = N'Table', @level1name = 'Address',
@level2type = N'Column', @level2name = 'PostalCode';
GO


http://msdn2.microsoft.com/en-us/library/ms180047.aspx

No comments:

Post a Comment