SqlServer字段说明查询 SELECT t.[name] AS 表名,c.[name] AS 字段名,cast(ep.[value] )) AS [字段说明] FROM sys.tables AS t INNER JOIN sys.columns AS c ON t.object_id = c.object_id LEFT JOIN sys.extended_properties AS ep AND t.name='TableName' 快速查看表结构 --快速查看表结构(比较全面的) T…
--快速查看表结构(比较全面的) THEN obj.name ELSE '' END AS 表名, col.colorder AS 序号 , col.name AS 列名 , ISNULL(ep.[value], '') AS 列说明 , t.name AS 数据类型 , col.length AS 长度 , ) AS 小数位数 , THEN '√' ELSE '' END AS 标识 , FROM dbo.sysindexes si INNER JOIN dbo.sysindexkeys si…
sqlserver中 字段内容做in条件用到方法:CHARINDEX(value,situation) 列变行显示用到:stuff 详情自行查找. 例子: stuff((select ','+name from SYS_DICT where dictcode = 'SITUATION' and CHARINDEX(value,situation)>0 FOR xml path('')), 1, 1, '') as situationValue…
SELECT t.[name] AS 表名,c.[name] AS 字段名,cast(ep.[value] )) AS [字段说明] FROM sys.tables AS t INNER JOIN sys.columns AS c ON t.object_id = c.object_id LEFT JOIN sys.extended_properties AS ep ON ep.major_id = c.object_id AND ep.minor_id = c.column_id WHERE…
可以自己查询系统表: SELECT o.name AS tableName, c.name AS columnName, p.[value] AS Description FROM sysproperties p INNER JOIN sysobjects o ON o.id = p.id INNER JOIN syscolumns c ON p.id = c.id AND p.smallid = c.colid WHERE (p.name = 'MS_Description') ORDER B…
SQLSERVER读懂语句运行的统计信息 对于语句的运行,除了执行计划本身,还有一些其他因素要考虑,例如语句的编译时间.执行时间.做了多少次磁盘读等. 如果DBA能够把问题语句单独测试运行,可以在运行前打开下面这三个开关,收集语句运行的统计信息. 这些信息对分析问题很有价值. 1 SET STATISTICS TIME ON 2 SET STATISTICS IO ON 3 SET STATISTICS PROFILE ON SET STATISTICS TIME ON 请先来看看SET STA…