2015-02-26 14:51:10藍宇星

crusor for 迴圈

--crusor for 迴圈

declare @vipno_d2 varchar(12) --宣告參數

declare cursor_d2 cursor for   --宣告crusor標記

select card_no from #fix_d2_integral    --將要寫入參數的資料寫入

open cursor_d2  --crusor開始

fetch next from cursor_d2 into @vipno_d2   
while @@fetch_status = 0
begin

exec pr_vip_integral_recount @vipno_d2      --要執行的語法

fetch next from cursor_d2 into @vipno_d2;
end

close cursor_d2  --crusor結束
deallocate cursor_d2  --移除標記