首页 > 代码库 > 查询数据库字段
查询数据库字段
select AA.columnname,AA.tablename ,AA.typename,AA.max_length,AA.precision,AA.scale ,BB.remark from (select a.name as columnname,b.name tablename ,c.name typename,a.max_length,a.precision,a.scalefrom sys.columns a,sys.objects b,sys.types cwhere a.object_id=b.object_id and a.user_type_id=c.user_type_idand b.type=‘u‘ ) AA LEFT JOIN(select a.name as columnname,b.name tablename ,c.name typename,a.max_length,a.precision,a.scale,cast(isnull(e.[value],‘‘) as nvarchar(100)) as remarkfrom sys.columns a,sys.objects b,sys.types c,sys.extended_properties ewhere a.object_id=b.object_id and a.user_type_id=c.user_type_idand b.type=‘u‘and e.major_id=b.object_id and e.minor_id=a.column_id and e.class=1) BB on AA.columnname=BB.columnname AND AA.tablename=BB.tablename ORDER BY AA.tablename
select a.name, cast(isnull(e.[value],‘‘) as nvarchar(100)) as remark from sys.columns a inner join sys.objects c on a.object_id=c.object_id and c.type=‘u‘left join sys.extended_properties e on e.major_id=c.object_id and e.minor_id=a.column_id and e.class=1 where c.name=‘AssistEngineer‘
select a.name as columnname,b.name tablename ,c.name typename,a.max_length,a.precision,a.scale,cast(isnull(e.[value],‘‘) as nvarchar(100)) as remarkfrom sys.columns a,sys.objects b,sys.types c,sys.extended_properties ewhere a.object_id=b.object_id and a.user_type_id=c.user_type_idand b.type=‘u‘and e.major_id=b.object_id and e.minor_id=a.column_id and e.class=1--and c.name in(‘varchar‘,‘nvarchar‘,‘char‘,‘nchar‘,‘text‘,‘ntext‘)--and object_name(a.object_id)<>‘t‘order by b.name
查询数据库字段
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。