查找包含某字段名的表名

select a.name as 表名
from sysobjects a
left join syscolumns b on a.id=b.id
where a.xtype='U' and b.name='字段名'

 

 --查找不包含指定字段的表名

select a.name as 表名
from sysobjects a
left join syscolumns b on a.id=b.id
where a.xtype='U'
EXCEPT
select a.name as 表名
from sysobjects a
left join syscolumns b on a.id=b.id
where a.xtype='U' and b.name='字段名'
'

 

posted @ 2015-09-12 17:52  Alfred.Xu  阅读(469)  评论(0编辑  收藏  举报