@@ Cursor_Rows = -1问题 [英] @@Cursor_Rows =-1 issue

查看:258
本文介绍了@@ Cursor_Rows = -1问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有游标打开状态,我试图通过@@ CURSOR_ROWS检索它中的数字行,它给出了-1,怎么能解决这个问题。请帮助我

I have cursor opened state ,I tried to retrieve the number rows in it through @@CURSOR_ROWS,it gives -1,how can solve this problem. pls help me

推荐答案

你应该使用
FETCH NEXT FROM <my_cursor>;</my_cursor>



光标在完全填充后返回总行数。否则您可能会得到不同的结果。请参阅 @@ CURSOR_ROWS(Transact-SQL) [ ^ ]了解详情



upd。

我想你是因为异步游标操作而得到的。因此,您可以执行以下sp_configure cursor threshold -1以使keysets同步生成。有关详细信息,请参阅这些链接:

如何:配置游标阈值选项 [ ^ ]

游标阈值选项 [ ^ ]


The cursor returns a total number of rows when it fully populated. Otherwise you may get a different result. Please see @@CURSOR_ROWS (Transact-SQL)[^] for details

upd.
I suppose that you are getting this beacause of asynchronous cursor operation. So you may do the following sp_configure cursor threshold -1 to enable keysets to generate synchronously. Please refer these links for details:
How to: Configure the cursor threshold Option[^]
cursor threshold Option[^]


这篇关于@@ Cursor_Rows = -1问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆