Getting each Column Descriptions

Apr 29, 2013 at 5:17 AM
Edited Apr 29, 2013 at 8:09 AM
Hello,
is it possible to read the Column Description values
as well as the Extended Properties for each table
for SQL Server 2012.

i have been trying to follow the logic
http://grab.by/m44w
http://grab.by/m46I
Thanks .. this is the best project ever.. amazing code practices too
Apr 29, 2013 at 7:57 AM
Edited Apr 29, 2013 at 8:40 AM
my question is how to write the SQL statement, because I only get null values http://grab.by/m48M for the description and I added some descriptions on a few columns)
http://grab.by/m46C
Regards
Coordinator
Apr 30, 2013 at 6:17 AM
It's already in the latest code (SqlServerSchemaReader.ColumnDescription)
Minus the table/schema selection, the SQL I use is below (minus the table and schema restrictions):
SELECT 
    SchemaOwner = s.name, 
    TableName = o.name,
    ColumnName = c.name,
    ColumnDescription = p.value
FROM sysobjects o
INNER JOIN syscolumns c
    ON o.id = c.id
INNER JOIN  sys.schemas s
    ON s.schema_id = o.uid
INNER JOIN sys.extended_properties p 
    ON p.major_id = c.id
    AND p.minor_id = c.colid
    AND p.name = 'MS_Description'
WHERE 
    o.type= 'U' 
ORDER BY s.name, o.name
It's an inner join to sys.extended_properties, as if there are no descriptions I don't need the full result set (less data to process).
May 11, 2013 at 12:44 AM
Edited May 11, 2013 at 12:44 AM
Martin.
you
Rob https://twitter.com/eisenbergeffect
and Ward Bell https://twitter.com/wardbell/
are the best developers i know of

Thanks