간단 Ms-Sql Cursor

database 2009. 7. 10. 14:00
begin
    DECLARE @seq int

    DECLARE sn_cursor CURSOR
    FOR
        select seq, content from dbo.test
    OPEN sn_cursor
    FETCH NEXT FROM sn_cursor INTO @seq
    WHILE @@FETCH_STATUS = 0
    BEGIN
        insert into dbo.test2 (seq) values (@seq)
        FETCH NEXT FROM sn_cursor INTO @seq
    END
    close sn_cursor
    deallocate sn_cursor
end

: