How to quickly find a table with a keyword in MYQL SQL Server

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.