begin
declare @title varchar(20)
declare @sql varchar(1000)
set @sql=''
declare t_cursor cursor for select name from syscolumns where id=(select id from sysobjects where name='a_dpgj') and type=39
open t_cursor
fetch next from t_cursor into @title
while @@fetch_status=0
begin
set @sql='update a_dpgj set '+@title +'=''小试一把'''
exec (@sql)
fetch next from t_cursor into @title
end
close t_cursor
deallocate t_cursor
end
declare @title varchar(20)
declare @sql varchar(1000)
set @sql=''
declare t_cursor cursor for select name from syscolumns where id=(select id from sysobjects where name='a_dpgj') and type=39
open t_cursor
fetch next from t_cursor into @title
while @@fetch_status=0
begin
set @sql='update a_dpgj set '+@title +'=''小试一把'''
exec (@sql)
fetch next from t_cursor into @title
end
close t_cursor
deallocate t_cursor
end