MySQL数据库查询带有某个字段的所有表名:
(1)精确查询语句如下:
SELECT * FROM information_schema.columns WHERE column_name='column_name';
(2)模糊匹配查询
SELECT * FROM information_schema.columns WHERE column_name LIKE '%column_name%';
Oracle数据库查询带有某个字段的所有表名:
(1)精确查询语句如下:
SELECT column_name,table_name FROM user_tab_columns WHERE column_name='column_name';
(2)模糊匹配查询
SELECT column_name,table_name,FROM user_tab_columns WHERE column_name LIKE '%column_name%';
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 '%字段名%')