本文介绍了长时间运行SQL CURSOR的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用CURSOR的存储过程,大约需要3分钟才能运行。它在Management Studio中运行良好,但在我的Application.I中已将命令超时增加到600.现在,有时我将完整的结果输入应用程序(当我执行程序4或5次时)



任何人都可以帮我在第一次执行时检索完整的结果....





现在我从查询中删除了所有游标,并将执行时间减少到20秒或更短。但问题仍然存在。结果不完整,我的结果中删除了很多行。(我只获得11965条记录)

解决方案




I have a Stored Procedure with CURSOR which takes around 3 minutes to run. It works fine in the Management Studio, but not in my Application.I have increased its command timeout to 600. Now, Sometimes I gets full results into the Application(When I am executing the procedure 4 or 5 times)

Can any one help me to retrieve full result on first time execution itself....


Now I removed all cursors from the query and reduced the execution time to "20 secs or less ". But Still the problem exists. The result is not complete, many rows are removed from my result.(I gets only 11965 records)

解决方案




这篇关于长时间运行SQL CURSOR的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-31 06:37