如题。我可以简单地将光标的位置重置为 Transact-SQL 中的开头,以便它可以在表上再次运行吗?我想在以下情况下重置它:
DECLARE @userID INT
DECLARE user_cursor CURSOR FOR SELECT userID FROM users
WHILE /* some condition */
BEGIN
...
FETCH NEXT FROM user_cursor INTO @userID
IF @@FETCH_STATUS = 0
BEGIN
/*... here goes the reset of the cursor ...*/
END
...
END