SqlServer查询字段属于哪个表

use TopwoxLimsYTG --数据库名称
go
SELECT
     表名       = D.name ,
     字段序号   = A.colorder,
     字段名     = A.name,
     类型       = B.name,
     字段说明=isnull(g.[value],'')
 FROM syscolumns A 
 LEFT JOIN systypes B ON A.xusertype=B.xusertype
 INNER JOIN sysobjects D ON A.id=D.id  and D.xtype='U' and  D.name<>'dtproperties'
 LEFT JOIN sys.extended_properties G ON a.id=g.major_id   and   a.colid=g.minor_id    
     WHERE A.name= 'IsFlatAccount'--字段名

 

posted @ 2019-08-13 16:29  Cein  阅读(1644)  评论(0编辑  收藏  举报