这是一个SQL Server6.5存储过程中使用Cursor,供参考
CREATE PROCEDURE uspCursor AS
begin
DECLARE @FirstPara int,
@SecondPara Int,
DECLARE MyTest CURSOR For
SELECT * FROM MyTab
WHERE ......
OPEN MyTest
FETCH MyTest INTO @FirstPara int,
@SecondPara Int,
WHILE @@fetch_status >=0
BEGIN
Do something
END
end
GO