Can I reset cursor's position to the beginning?

前端 未结 4 1999
感动是毒
感动是毒 2020-12-29 22:27

As in the topic. Can I simply reset cursor\'s position to the beginning in Transact-SQL, so it can run again over the table? I want to reset it in the following context:

4条回答
  •  清歌不尽
    2020-12-29 23:04

    Another option that can be used that doesn't force you to change the type of cursor is simply to close the cursor and re-open it:

    CLOSE user_cursor
    OPEN user_cursor
    

    But the scroll option will be cheaper in terms of resource usage, if that's a change you can accept.

提交回复
热议问题