日期:2014-05-19  浏览次数:20566 次

救命啊,为何@@cursor_rows返回0的?
奇怪了,为何我无论用select命令返回了多少条记录,@@cursor_rows总是为0的?
就算在查询分析器中用select命令,看到消息栏中写(所影响的行数为   5   行),但select   @@cursor_rows出来的结果还是为0,何解????
请大家救命啊!

------解决方案--------------------
--示例

SELECT @@CURSOR_ROWS
DECLARE authors_cursor CURSOR FOR
SELECT au_lname FROM authors
OPEN authors_cursor
FETCH NEXT FROM authors_cursor
SELECT @@CURSOR_ROWS
CLOSE authors_cursor
DEALLOCATE authors_cursor

------解决方案--------------------
@@cursor_rows返回连接上最后打开的游标中当前存在的合格行的数量
你用select查询当然返回0,要看select\update\insert\delete请用@@rowcount