[研究]T-SQL,列出所有 TTTT 開頭的 table 的所有欄位 的 schema 和描述說明
2024-03-05
環境:Visual Studio 2022 + ASP.NET + WebForm + Web Application + C# + SQL Server 2019 + SQL Server Management Studio (SSMS) 19
********************************************************************************
T-SQL
SELECT c.TABLE_SCHEMA, c.TABLE_NAME, c.COLUMN_NAME, c.DATA_TYPE, c.CHARACTER_MAXIMUM_LENGTH, c.COLUMN_DEFAULT, c.IS_NULLABLE, CASE WHEN ep.value IS NULL THEN 'No description available' ELSE ep.value END AS COLUMN_DESCRIPTION FROM INFORMATION_SCHEMA.COLUMNS c LEFT JOIN sys.extended_properties ep ON ep.major_id = OBJECT_ID(c.TABLE_SCHEMA + '.' + c.TABLE_NAME) AND ep.minor_id = c.ORDINAL_POSITION WHERE c.TABLE_NAME LIKE 'TTTT%' |
(完)
相關
沒有留言:
張貼留言