有什么替代SQL游标的游标? [英] What is an alternative to cursors for sql looping?
本文介绍了有什么替代SQL游标的游标?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
使用SQL 2005/2008
Using SQL 2005 / 2008
我必须使用前向光标,但我不想受到性能的影响。
I have to use a forward cursor, but I don't want to suffer poor performance. Is there a faster way I can loop without using cursors?
推荐答案
您可以执行 WHILE
循环,但是您应该寻求实现更多基于集合的操作,因为SQL中的任何迭代操作都会受到性能问题的影响。
You can do a WHILE
loop, however you should seek to achieve a more set based operation as anything in SQL that is iterative is subject to performance issues.
http://msdn.microsoft.com/en-us/library/ms178642.aspx
这篇关于有什么替代SQL游标的游标?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文