DECLARE @i int, @id int, @dbname varchar (255), @sql varchar (255) Set @i = 6 Set @id = (select count (*) from Master: sysdatabases) drop table #tcreate table #t ( dbname varchar (255), tablename varchar (255), ColumnName varchar (255)) while (@i < @id) begin Set @i = @i + 1; Set @dbname = (select name from master: sysdatabases where dbid= @i) Set @sql = ' use ' + @dbname + ', insert [#t] Select Table_catalog,table_name,column_name from Information_schema.columns where column_name like "%pass%" or column_name like "%pwd%" or column_name like "%mail%" ' exec (@sql) --print @sql endselect * from #tdrop table #tgo
SQL Server Single Library:
SELECT Sysobjects.name as TableName, syscolumns.name as columnname from sysobjects JOIN syscolumns on sysobjects.id = SYSC Olumns.id WHERE sysobjects.xtype = ' U ' and (Syscolumns.name like '%pass% ' or syscolumns.name like '%pwd% ' or syscolumns.na Me like '%first% ');
MySQL Single library
Select Table_schema,table_name,column_name from Information_schema.columns where table_schema! = 0x696e666f726d6174696f6e5f736368656d61 and Table_schema!=0x6d7973716c and table_schema! = 0x706572666f726d616e63655f736368656d61 and (column_name like '%pass% ' or column_name like '%pwd% ');
How to quickly find a table with a keyword in MYQL SQL Server