SQLServer 查询所有表有指定字段的

--同时含有语言编号字段的所有表

select a.[name] from sysobjects a,
(
select [id],count(*) b from syscolumns
where [name] ='F_LanguageCode'
group by [id]
) b
where a.[id]=b.[id]

--同时含有语言编号和排序字段的所有表

select a.[name] from sysobjects a
left join
(
select [id],count() b from syscolumns where [name]
in('F_LanguageCode','F_Order') group by [id] having count(
)>1
) b
on a.[id]=b.[id]
where b.id is not null

posted @ 2021-01-25 15:17  luckcc  阅读(482)  评论(0)    收藏  举报