Skip to content

Instantly share code, notes, and snippets.

@kshimi
Created March 14, 2019 09:56
Show Gist options
  • Save kshimi/a1835603a21178bbebe19e7b14f8c6d1 to your computer and use it in GitHub Desktop.
Save kshimi/a1835603a21178bbebe19e7b14f8c6d1 to your computer and use it in GitHub Desktop.
SQLServer get column comment
--カラムの説明
SELECT
t.name AS 'TableName',
c.name AS 'ColumnName',
ep.name AS 'PropertyName',
ep.value AS 'PropertyValue'
FROM
sys.tables t
INNER JOIN
sys.columns c
ON
c.object_id = t.object_id
INNER JOIN
sys.extended_properties ep
ON
ep.major_id = c.object_id
AND
ep.minor_id = c.column_id
WHERE
ep.name LIKE 'MS_Description'
  AND t.name = 'NAMES'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment