查找包含某字段名的表名

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 @   Alfred.Xu  阅读(471)  评论(0编辑  收藏  举报
点击右上角即可分享
微信分享提示