SQL Server查询库中包含某个字段的表

格式如下:

select [name] from [库名].[dbo].sysobjects where id in(select id from [库名].[dbo].syscolumns Where name='字段名')

例如:查询“DB100”库中包含“UserName”字段的所有表。

示例脚本如下:

select [name] from [DB1000].[dbo].sysobjects where id in(select id from [DB1000].[dbo].syscolumns Where name='UserName')

猜你喜欢

转载自www.cnblogs.com/bing-xinyuan/p/12023104.html
今日推荐