转载自:
http://blog.sina.com.cn/s/blog_55bf1908010104mi.html
表名=CASE WHENC.column_ID=1 THEN O.name ELSE N'' END, 表说明=ISNulL(CASE WHEN C.column_ID=1 THEN PTB.[value] END,N''), 字段序号=C.column_ID, 字段名=C.name, 主键=ISNulL(IDX.PrimaryKey, 标识=CASE WHENC.is_IDentity=1 THEN N'√'ELSE N'' END, 计算列=CASEWHEN C.is_computed=1 THEN N'√'ELSE N'' END, 类型=T.name, 长度=C.max_length, 精度=C.precision, 小数位数=C.scale, 允许空=CASEWHEN C.is_nullable=1 THEN N'√'ELSE N'' END, 默认值=ISNulL(D.deFinition, 字段说明=ISNulL(PFD.[value], 索引名=ISNulL(IDX.Indexname, 索引排序=ISNulL(IDX.sort, 创建时间=O.Create_Date, 修改时间=O.Modify_date FROM sys.columns C INNER JOINsys.objects O ON C.[object_ID]=O.[object_ID] AND O.type='U' AND O.is_ms_shipped=0 INNER JOINsys.types T ON C.user_type_ID=T.user_type_ID left JOINsys.default_constraints D ON C.[object_ID]=D.parent_object_ID AND C.column_ID=D.parent_column_ID AND C.default_object_ID=D.[object_ID] left JOIN sys.extended_propertIEs PFD ON PFD.class=1 AND C.[object_ID]=PFD.major_ID AND C.column_ID=PFD.minor_ID -- AND PFD.name='Caption' --字段说明对应的描述名称(一个字段可以添加多个不同name的描述) left JOINsys.extended_propertIEs PTB ON PTB.class=1 AND PTB.minor_ID=0 AND C.[object_ID]=PTB.major_ID -- AND PFD.name='Caption' --表说明对应的描述名称(一个表可以添加多个不同name的描述) leftJOIN -- 索引及主键信息 ( SELECT Idxc.[object_ID], Idxc.column_ID, Sort=CASEINDEXKEY_PROPERTY(Idxc.[object_ID],Idxc.index_ID,Idxc.index_column_ID,'IsDescending') WHEN 1 THEN 'DESC' WHEN 0 THEN 'ASC' ELSE '' END, PrimaryKey=CASE WHEN IDX.is_primary_key=1 THEN N'√'ELSE N''END, Indexname=IDX.name FROM sys.indexes IDX INNER JOIN sys.index_columns Idxc ON IDX.[object_ID]=Idxc.[object_ID] AND IDX.index_ID=Idxc.index_ID left JOIN sys.key_constraints KC ON IDX.[object_ID]=KC.[parent_object_ID] AND IDX.index_ID=KC.unique_index_ID INNER JOIN -- 对于一个列包含多个索引的情况,只显示第1个索引信息 ( SELECT [object_ID],Column_ID,index_ID=MIN(index_ID) FROM sys.index_columns GROUP BY [object_ID],Column_ID ) IdxcUQ ON Idxc.[object_ID]=IdxcUQ.[object_ID] AND Idxc.Column_ID=IdxcUQ.Column_ID AND Idxc.index_ID=IdxcUQ.index_ID ) IDX ON C.[object_ID]=IDX.[object_ID] AND C.column_ID=IDX.column_ID --WHERE O.name = 'vIEwvoutpage' --如果只查询指定表,加上此条件 ORDER BY O.name,C.column_ID 总结
以上是内存溢出为你收集整理的如何查看SqlServer表 索引 创建时间,修改时间全部内容,希望文章能够帮你解决如何查看SqlServer表 索引 创建时间,修改时间所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)