日期:2014-05-16  浏览次数:20362 次

游标的使用,简单示例

DECLARE
Employee_Cursor
CURSOR FOR SELECT top 2 usr_code,usr_desc FROM r5users
OPEN Employee_Cursor
FETCH NEXT FROM Employee_Cursor
WHILE @@FETCH_STATUS = 0
BEGIN
?FETCH NEXT FROM Employee_Cursor
END
CLOSE Employee_Cursor DEALLOCATE Employee_Cursor