日期:2014-05-17 浏览次数:20740 次
DECLARE @what varchar(100) SET @what='烟'
declare @sql varchar(max)
declare tablecursor cursor local for
select sql='if exists (select 1 FROM '+a.name+' WHERE '+b.name+' LIKE ''%'+@what+'%'')
PRINT ''[表,字段]:'+a.name+','+b.name+''''
from sysobjects a,syscolumns b where a.id=b.id
and a.xtype='u'
open TableCursor
fetch next from tablecursor into @sql
while @@fetch_status=0
begin
exec(@sql)
fetch next from tablecursor into @sql
end
close tablecursor
deallocate TableCursor