如在主题中.我可以简单地将光标的位置重置为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
Run Code Online (Sandbox Code Playgroud)