declare @n varchar(30)
declare @key varchar(20)
set @key='关键字'
declare cur cursor for
select a.name from syscolumns a Inner Join systypes b on a.id=b.id where id=object_id('表') and b.name in('varchar','char','nvarchar','nchar','sysname')
fetch next from cur into @n
while @@fetch_status=0
begin
if exists(select 1 from [表] where charindex(@key,@n)>0)
print @n +'中存在!'
fetch next from cur into @n
end
close cur
deallocate
declare @key varchar(20)
set @key='关键字'
declare cur cursor for
select a.name from syscolumns a Inner Join systypes b on a.id=b.id where id=object_id('表') and b.name in('varchar','char','nvarchar','nchar','sysname')
fetch next from cur into @n
while @@fetch_status=0
begin
if exists(select 1 from [表] where charindex(@key,@n)>0)
print @n +'中存在!'
fetch next from cur into @n
end
close cur
deallocate