TSQL to get FieldName & FieldDescription within a SQL Server database

Published 25 July 07 07:52 AM | SQL Master 

When you are documenting a database including the table-column information you need to have a description that can specify that so and so column is used for such a purpose. Think about accessing such information using Enterprise Manager or SS Management Studio, you have perform the chore by right-clicking on a table and choosing Design Table, on the Columns tab - "Description". Using the following TSQL you can get this information:

select cols.table_name, cols.column_name, sp.value as [description] from information_schema.columns cols
left join sysproperties sp on sp.id = object_id('syslogins') and sp.smallid=cols.ordinal_position and sp.name='MS_Description'
where cols.table_name='syslogins'

Comments

# SSQA.net - SqlServer-QA.net said on July 25, 2007 1:12 PM:

When you are documenting a database including the table-column information you need to have a description

# Rhonda Tipton’s WebLog Links - 07.29.07 « said on July 29, 2007 5:02 PM:

PingBack from http://rtipton.wordpress.com/2007/07/29/links-072907/

Anonymous comments are disabled

About SQL Master

**__________________________________** SQL Server MVP, Sr. DBA & industry expert. - Knowledge is of two kinds. We know a subject ourselves or we know where we can find information on it. It is also a power and you will gain by sharing it.