SELECT c.name AS [column name]
,DATA_TYPE [data type]
,CHARACTER_MAXIMUM_LENGTH [length]
,IS_NULLABLE [isnull]
,cd.value AS [desc]
FROM sysobjects t
INNER JOIN sysusers u ON u.uid = t.uid
LEFT OUTER JOIN sys.extended_properties td ON td.major_id = t.id
AND td.minor_id = 0
AND td.name = 'MS_Description'
INNER JOIN syscolumns c ON c.id = t.id
LEFT OUTER JOIN sys.extended_properties cd ON cd.major_id = c.id
AND cd.minor_id = c.colid
AND cd.name = 'MS_Description'
LEFT OUTER JOIN INFORMATION_SCHEMA.COLUMNS ON t.name = TABLE_NAME
AND c.name = COLUMN_NAME
WHERE t.type = 'u'
AND t.name = 'TableName'
ORDER BY t.name
,c.colorder
,DATA_TYPE [data type]
,CHARACTER_MAXIMUM_LENGTH [length]
,IS_NULLABLE [isnull]
,cd.value AS [desc]
FROM sysobjects t
INNER JOIN sysusers u ON u.uid = t.uid
LEFT OUTER JOIN sys.extended_properties td ON td.major_id = t.id
AND td.minor_id = 0
AND td.name = 'MS_Description'
INNER JOIN syscolumns c ON c.id = t.id
LEFT OUTER JOIN sys.extended_properties cd ON cd.major_id = c.id
AND cd.minor_id = c.colid
AND cd.name = 'MS_Description'
LEFT OUTER JOIN INFORMATION_SCHEMA.COLUMNS ON t.name = TABLE_NAME
AND c.name = COLUMN_NAME
WHERE t.type = 'u'
AND t.name = 'TableName'
ORDER BY t.name
,c.colorder
No comments:
Post a Comment