获取表SQLSERVER 的表结构信息(字段名,长度,精度,类型,NULL,ID,PRI)

获取表SQLSERVER 的表结构信息(字段名,长度,精度,类型,NULL,ID,PRI),第1张

概述select sys.columns.name, sys.types.name, sys.columns.precision,sys.columns.scale, sys.columns.is_nullable, (select count(*) from sys.identity_columns where sys.identity_columns.object_id = sys.col
select sys.columns.name,sys.types.name,sys.columns.precision,sys.columns.scale,sys.columns.is_nullable,(select count(*) from sys.IDentity_columns where sys.IDentity_columns.object_ID = sys.columns.object_ID and sys.columns.column_ID = sys.IDentity_columns.column_ID) as is_IDentity,(select value from sys.extended_propertIEs where sys.extended_propertIEs.major_ID = sys.columns.object_ID and sys.extended_propertIEs.minor_ID = sys.columns.column_ID) as description,( SELECT count(*) FROM sysobjects  WHERE (name in (SELECT name FROM sysindexes  WHERE (ID = a.ID) AND (indID in  (SELECT indID FROM sysindexkeys  WHERE (ID = a.ID) AND (colID in  (SELECT colID FROM syscolumns WHERE (ID = a.ID) AND (name = a.name)))))))  AND (xtype = 'PK') ) as is_key   from sys.columns,sys.tables,sys.types,syscolumns a   where   sys.columns.object_ID = sys.tables.object_ID and   sys.columns.system_type_ID=sys.types.system_type_ID and   a.ID = sys.tables.object_ID  and a.ID = sys.columns.object_ID and a.name = sys.columns.name and   sys.tables.name='yk_typk'   order by sys.columns.column_ID


YPCD	numeric	4	0	0	0	NulL	1CDMC	varchar	0	0	1	0	NulL	0PYDM	varchar	0	0	1	0	NulL	0CDQC	varchar	0	0	1	0	NulL	0
总结

以上是内存溢出为你收集整理的获取表SQLSERVER 的表结构信息(字段名,长度精度,类型,NULL,ID,PRI)全部内容,希望文章能够帮你解决获取表SQLSERVER 的表结构信息(字段名,长度,精度,类型,NULL,ID,PRI)所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/sjk/1164627.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-06-01
下一篇 2022-06-01

发表评论

登录后才能评论

评论列表(0条)

保存