access查询所有字段 高手来~

来源:百度知道 编辑:UC知道 时间:2024/09/24 13:46:33
我现在有a b c d e f表 甚至更多,我想在 a b c d e f 所有表 所有字段 中查询一个 like '%abc%' 的信息要怎么写.
中国没希望了..中文都有人看不懂...楼下的小朋友你们说的那个谁不知道..看清楚我问的是什么问题了吗..

declare @str varchar(100)
set @str like '%abc%' --要搜索的字符串

declare @s varchar(8000)
declare tb cursor local for
select s='if exists(select 1 from ['+b.name+'] where ['+a.name+'] like ''%'+@str+'%'')
print ''所在的表及字段: ['+b.name+'].['+a.name+']'''
from syscolumns a join sysobjects b on a.id=b.id
where b.xtype='U' and a.status>=0
and a.xusertype in(175,239,231,167)
open tb
fetch next from tb into @s
while @@fetch_status=0
begin
exec(@s)
fetch next from tb into @s
end
close tb
deallocate tb

select * from 表名 where 字段 like '%你要查的数%'
% 统配符号

select ID from 表名 where ID like '[0-9]'
[] 范围