[MS-SQL]一些抓取資料庫結構及述敍用的 SQL
--抓所有的 Table Select * from INFORMATION_SCHEMA.TABLES --抓所有的 COLUMNS Select * from INFORMATION_SCHEMA.COLUMNS --抓欄位的 Description select st.name [Table], sc.name [Column], sep.value [Description] from sys.tables st inner join sys.columns sc on st.object_id = sc.object_id left join sys.extended_properties sep on st.object_id = sep.major_id and sc.column_id = sep.minor_id and sep.name = 'MS_Description' where st.name = 'TableName' and sc.name = 'ColumnName' --修改欄位的 Description. EXEC sp_updateextendedproperty @name = N'MS_Description', @value = 'Your description', @level0type = N'Schema', @level0name = 'dbo', @level1type = N'Table',...