sqlServer字段说明查询
SELECT t.[name] AS 表名,c.AS 字段名,cast(ep.value] as varchar(100)) 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 AND ep.minor_ID = c.column_ID WHERE ep.class =1 AND t.name='tablename'
快速查看表结构
--快速查看表结构(比较全面的)SELECT CASE WHEN col.colorder = 1 THEN obj.name ELSE '' END AS 表名,col.colorder AS 序号,col.name AS 列名,ISNulL(ep.],0)">'') AS 列说明,t.name AS 数据类型,col.length AS 长度,255)">ISNulL(ColUMNPROPERTY(col.ID,col.name,0)">Scale'),0) AS 小数位数,255)">WHEN IsIDentity') THEN √' '' AS 标识,255)">WHEN EXISTS ( SELECT 1 FROM dbo.sysindexes si JOIN dbo.sysindexkeys sik ON si.ID = sik.ID AND si.indID = sik.indID JOIN dbo.syscolumns sc ON sc.ID AND sc.colID = sik.colID JOIN dbo.sysobjects so ON so.name = si.name AND so.xtype = PK' WHERE sc.ID = col.ID = col.colID ) AS 主键,255)">WHEN col.isnullable AS 允许空,255)">ISNulL(comm.text,255)">AS 默认值FROM dbo.syscolumns col left JOIN dbo.systypes t ON col.xtype = t.xusertype inner JOIN dbo.sysobjects obj ON col.ID = obj.ID AND obj.xtype U' AND obj.status >= 0 JOIN dbo.syscomments comm ON col.cdefault = comm.ID JOIN sys.extended_propertIEs ep = ep.major_ID AND col.colID = ep.minor_ID AND ep.name MS_Description' JOIN sys.extended_propertIEs epTwo ON obj.ID = epTwo.major_ID AND epTwo.minor_ID 0 AND epTwo.name 'WHERE obj.name '表名ORDER BY col.colorder ; 总结以上是内存溢出为你收集整理的SqlServer字段说明查询及快速查看表结构全部内容,希望文章能够帮你解决SqlServer字段说明查询及快速查看表结构所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)