标签:min har databases 创建 end HERE sys serve cte
SELECT * FROM MASTER.DBO.SYSDATABASES
SELECT * FROM sys.SYSOBJECTS WHERE XTYPE=‘U‘
SELECT * FROM sys.SYSCOLUMNS WHERE ID IN (SELECT ID FROM sys.SYSOBJECTS WHERE XTYPE=‘U‘ AND NAME = ‘表名‘)
SELECT * FROM sys.extended_properties LEFT JOIN sys.SYSOBJECTS ON sys.SYSOBJECTS.id = sys.extended_properties.major_id LEFT JOIN INFORMATION_SCHEMA.columns ON (INFORMATION_SCHEMA.columns.ORDINAL_POSITION = sys.extended_properties.minor_id AND INFORMATION_SCHEMA.columns.TABLE_NAME = sys.SYSOBJECTS.name) WHERE major_id IN (SELECT ID FROM sys.SYSOBJECTS WHERE XTYPE=‘U‘ AND NAME = ‘表名‘) AND INFORMATION_SCHEMA.columns.TABLE_NAME is not null
-- 提取适当的列 SELECT INFORMATION_SCHEMA.columns.TABLE_CATALOG AS 数据库名, INFORMATION_SCHEMA.columns.TABLE_NAME AS 表名, INFORMATION_SCHEMA.columns.COLUMN_NAME AS 列名, INFORMATION_SCHEMA.columns.DATA_TYPE AS 数据类型, INFORMATION_SCHEMA.columns.CHARACTER_MAXIMUM_LENGTH AS varchar长度, sys.extended_properties.value AS 描述 FROM sys.extended_properties LEFT JOIN sys.SYSOBJECTS ON sys.SYSOBJECTS.id = sys.extended_properties.major_id LEFT JOIN INFORMATION_SCHEMA.columns ON (INFORMATION_SCHEMA.columns.ORDINAL_POSITION = sys.extended_properties.minor_id AND INFORMATION_SCHEMA.columns.TABLE_NAME = sys.SYSOBJECTS.name) WHERE major_id IN (SELECT ID FROM sys.SYSOBJECTS WHERE XTYPE=‘U‘ AND NAME = ‘表名‘) AND INFORMATION_SCHEMA.columns.TABLE_NAME is not null
SELECT * FROM sys.extended_properties LEFT JOIN sys.SYSOBJECTS ON sys.SYSOBJECTS.id = sys.extended_properties.major_id LEFT JOIN INFORMATION_SCHEMA.columns ON (INFORMATION_SCHEMA.columns.ORDINAL_POSITION = sys.extended_properties.minor_id AND INFORMATION_SCHEMA.columns.TABLE_NAME = sys.SYSOBJECTS.name) WHERE major_id IN (SELECT ID FROM sys.SYSOBJECTS WHERE XTYPE=‘U‘) AND INFORMATION_SCHEMA.columns.TABLE_NAME is null
-- 提取适当的列 SELECT INFORMATION_SCHEMA.columns.TABLE_CATALOG AS 数据库名, sys.SYSOBJECTS.name AS 表名, INFORMATION_SCHEMA.columns.COLUMN_NAME AS 列名, INFORMATION_SCHEMA.columns.DATA_TYPE AS 数据类型, INFORMATION_SCHEMA.columns.CHARACTER_MAXIMUM_LENGTH AS varchar长度, sys.extended_properties.value AS 描述 FROM sys.extended_properties LEFT JOIN sys.SYSOBJECTS ON sys.SYSOBJECTS.id = sys.extended_properties.major_id LEFT JOIN INFORMATION_SCHEMA.columns ON (INFORMATION_SCHEMA.columns.ORDINAL_POSITION = sys.extended_properties.minor_id AND INFORMATION_SCHEMA.columns.TABLE_NAME = sys.SYSOBJECTS.name) WHERE major_id IN (SELECT ID FROM sys.SYSOBJECTS WHERE XTYPE=‘U‘) AND INFORMATION_SCHEMA.columns.TABLE_NAME is null
标签:min har databases 创建 end HERE sys serve cte
原文地址:https://www.cnblogs.com/lang-lang/p/12327615.html