SELECT
[Table Name] = i_s.TABLE_NAME,
[Description] = s.value
FROM
INFORMATION_SCHEMA.TABLES i_s
LEFT OUTER JOIN
sys.extended_properties s
ON
s.major_id = OBJECT_ID(i_s.TABLE_SCHEMA+'.'+i_s.TABLE_NAME)
AND s.name = 'MS_Description'
WHERE
OBJECTPROPERTY(OBJECT_ID(i_s.TABLE_SCHEMA+'.'+i_s.TABLE_NAME), 'IsMsShipped')=0
--AND i_s.TABLE_NAME = 'YourTableName'
ORDER BY
i_s.TABLE_NAME
ถ้าเลือกมาเฉพาะ Table ที่มี Extended Properties
SELECT objtype, objname, name, value FROM fn_listextendedproperty (NULL, 'schema', 'dbo', 'table', default, NULL, NULL)
หรือ แบบนี้ก็ได้ผลเหมือนกัน
SELECT objtype, objname, name, value FROM fn_listextendedproperty (NULL, 'schema', 'dbo', 'table', NULL, NULL, NULL)
No comments:
Post a Comment