DECLARE @User_id varchar (12)
, @pi_no int
, @pReg_cnt int
, @pReg_no int
-- 변수선언

DECLARE cursor_name CURSOR FOR
select pReg_no, User_id, pi_no, pReg_cnt from tbl_luckyCoin_prizeReg order by pReg_no

OPEN cursor_name
FETCH NEXT FROM cursor_name into @pReg_no, @User_id, @pi_no, @pReg_cnt

-- Check @@FETCH_STATUS to see if there are any more rows to fetch.
WHILE @@FETCH_STATUS = 0
    BEGIN
 -- 작업 기술

        -- This is executed as long as the previous fetch succeeds.
        FETCH NEXT FROM cursor_name into @pReg_no, @User_id, @pi_no, @pReg_cnt
    END
CLOSE cursor_name
DEALLOCATE cursor_name

+ Recent posts