SQL Server带游标的SQL

DECLARE test_cursor CURSOR
FOR
    SELECT  ID
    FROM    dbo.T_BD_Restaurant
    WHERE   id <> ‘0AAB2E55-79F8-4F41-AFFA-00179DFABDB0‘

OPEN test_cursor

DECLARE @RestaurantID NVARCHAR(100)

FETCH NEXT FROM test_cursor INTO @RestaurantID
WHILE @@FETCH_STATUS = 0 
    BEGIN

        PRINT @RestaurantID

        FETCH NEXT FROM test_cursor INTO @RestaurantID

    END
CLOSE test_cursor
DEALLOCATE test_cursor

  

SQL Server带游标的SQL,布布扣,bubuko.com

SQL Server带游标的SQL

上一篇:MySql 执行JDBC联接(增/删/改/查)操作


下一篇:十六、oracle 索引