select *
into #t
from calendar
declare @ww int, @ww_index int
declare #tempp cursor for
select ww, ww_index from #t where ww_index>470
open #tempp
fetch next from #tempp into @ww, @ww_index
while @@fetch_status = 0
begin
update #t set ww =2 where ww_index = 1
update #t set ww = 3 where ww_index = 2
update #t set ww= 222 where ww_index = 3
fetch next from #tempp into @ww, @ww_index
end
close #tempp
deallocate #tempp
--
select * from #t
drop table #t
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/23155850/viewspace-631513/
,如需转载,请注明出处,否则将追究法律责任。