Dowemo


declare @sql varchar(max)


DECLARE @id int 


declare @f5 varchar(50)


DECLARE vend_cursor CURSOR 


FOR select id,field_5 from hpclass


OPEN vend_cursor 


FETCH NEXT FROM vend_cursor into @id,@f5; 



set @sql=''


WHILE(@@fetch_status=0) 


BEGIN 


set @sql +='update hpclass set field_5='''+@f5+''' where id='+cast(@id as varchar(10))+';'; 


FETCH NEXT FROM vend_cursor into @id,@f5; 


END 


close vend_cursor --关闭游标 


deallocate vend_cursor 


print @sql









Copyright © 2011 Dowemo All rights reserved.    Creative Commons   AboutUs