sql如何查询整个数据库包含abc关键字的数据?

2025-02-24 09:31:54
推荐回答(4个)
回答1:

先把数据库中所有表名称找到 ,然后逐个表查询
declare @name varchar(50),@tt varchar(10)
set @tt = '%abc%'
declare cc cursor for
select name from sysobjects where xtype='U'
open cc
fetch cc into @name
while @@fetch_status = 0
begin
exec('selec *from '+@name +' where abc like '+@tt)
fetch cc into @name
end

回答2:

like ‘%abc%’

回答3:

如果单纯查找替换,可以转储SQL文件然后用编辑器搜索。

回答4:

只有按照表查,没有按照整库查的说法
比如select* from 表名 where abc like ‘%abc%’

或者
select* from 表名 where abc matches “*abc*”
等等