首页 > 数据库技术 > 详细

在myql sqlserver里边怎么快速找到带有关键字的表

时间:2014-05-29 22:14:35      阅读:550      评论:0      收藏:0      [点我收藏+]

sql server 全部库:

bubuko.com,布布扣
declare @i int,@id int,@dbname varchar(255),@sql varchar(255)
    set @i = 6
    set @id=(select count(*) from master..sysdatabases)

drop table #t
create 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
    end

select * from #t
drop table #t

go
bubuko.com,布布扣

sql server单个库:

SELECT sysobjects.name as tablename, syscolumns.name as columnname FROM sysobjects JOIN syscolumns ON sysobjects.id = syscolumns.id WHERE sysobjects.xtype = U AND (syscolumns.name LIKE %pass% or syscolumns.name LIKE %pwd% or syscolumns.name LIKE %first%);

mysql:

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%);

 

在myql sqlserver里边怎么快速找到带有关键字的表,布布扣,bubuko.com

在myql sqlserver里边怎么快速找到带有关键字的表

原文:http://www.cnblogs.com/hookjoy/p/3758110.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!