海航
加油(大道至简至易)

查寻sqlserver 表字段说明语句,查询结果 有图显示

DECLARE @table_name as varchar(max)
set @table_name ='表名'
SELECT sys.columns.name, sys.types.name,sys.columns.max_length, 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
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=@table_name
order
by sys.columns.column_id

 

posted on 2014-01-20 10:35  海航@  阅读(696)  评论(0编辑  收藏  举报

导航