Search This Blog

08 September 2010

Query to fetch description of all tables and columns in current database

SELECT major_id, minor_id, AS [Table Name], AS [Column Name], value AS [Extended Property]
FROM sys.extended_properties AS ep
INNER JOIN sys.tables AS t ON ep.major_id = t.object_id
INNER JOIN sys.columns AS c ON ep.major_id = c.object_id
AND ep.minor_id = c.column_id
WHERE class = 1

No comments:

Post a Comment