sqlserver 查询表结构,字段,类型,长度,描述信息通通有

sqlserver 查询表结构,字段,类型,长度,描述信息通通有
select sys.columns.name as 字段名, sys.types.name as 字段类型, sys.columns.max_length as 长度, sys.columns.is_nullable as 是否可空,
(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 是否自增长 ,
(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 描述
from sys.columns, sys.tables, sys.types where sys.columns.object_id
= sys.tables.object_id
and sys.columns.system_type_id=sys.types.system_type_id and sys.tables.name=TableName 
order
by sys.columns.column_id
View Code

 

sqlserver 查询表结构,字段,类型,长度,描述信息通通有,布布扣,bubuko.com

sqlserver 查询表结构,字段,类型,长度,描述信息通通有

上一篇:[转]如何将SQL Server表驻留内存和检测


下一篇:mysql 自定义排序顺序