用SQL语句查询数据库中带有某个字段的所有表名
SQLServer数据库查询带有某个字段的所有表名:
(1)精确查询语句如下:
SELECT [name] FROM [库名].[dbo].sysobjects WHERE id IN (SELECT id FROM [库名].[dbo].syscolumns WHERE name = '字段名')
(2)模糊匹配查询
SELECT [name] FROM [库名].[dbo].sysobjects WHERE id IN (SELECT id FROM [库名].[dbo].syscolumns WHERE name LIKE '%字段名%')