Sql 服务器递归游标?
Sql Server Recursive Cursor?
例如,如果我为 SELECT id FROM myTable
创建一个 Cursor,并在遍历它时插入到 myTable 中,cursor 会得到这个新值吗?
好吧,您可以试试看...直到您将光标声明为 static
。
参考MSDN:
STATIC
Defines a cursor that makes a temporary copy of the data to be
used by the cursor. All requests to the cursor are answered from this
temporary table in tempdb; therefore, modifications made to base
tables are not reflected in the data returned by fetches made to this
cursor, and this cursor does not allow modifications.
例如,如果我为 SELECT id FROM myTable
创建一个 Cursor,并在遍历它时插入到 myTable 中,cursor 会得到这个新值吗?
好吧,您可以试试看...直到您将光标声明为 static
。
参考MSDN:
STATIC
Defines a cursor that makes a temporary copy of the data to be used by the cursor. All requests to the cursor are answered from this temporary table in tempdb; therefore, modifications made to base tables are not reflected in the data returned by fetches made to this cursor, and this cursor does not allow modifications.