用临时y表替换光标,cte,查看 [英] replacing cursor with temporary y table ,cte,View

查看:75
本文介绍了用临时y表替换光标,cte,查看的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,


请告诉您最好更换光标

1个临时表
2个常用表表达式
3 View

Hi All,


Please tell which is best to replace cursor

1 temporary table
2 common table expression
3 View

推荐答案

在此处查看讨论.

http://social.msdn.microsoft.com/Forums/zh/transactsql/thread/bfa87d31-99c2-4919-bf57-ddcb88229cfc [ http://sql-server-performance.com/Community/forums/p/14176/81959.aspx [ ^ ]
Look at the discussions here.

http://social.msdn.microsoft.com/Forums/en/transactsql/thread/bfa87d31-99c2-4919-bf57-ddcb88229cfc[^]

http://sql-server-performance.com/Community/forums/p/14176/81959.aspx[^]


首先,您的问题是错误的,就像Sandeep所说的那样.

使用游标的替代方法:
-使用WHILE LOOPS
-使用临时表
-使用派生表
-使用相关子查询
-使用CASE语句
-执行多个查询


但在这里,我给了您
的链接 游标替代品"和这些东西之间的比较" 等.事物"

比较游标与WHILE循环性能SQL Server 2008 [ ^ ]

光标与While循环.游标的优点/缺点是什么 [光标vs临时表vs表可变性能 [ ^ ]

性能调整SQL Server游标 [使用SQL Server 2000表变量
消除对光标的需求
[ ^ ]

SQL SERVER –比较:相似性和差异性# TempTable与@TempVariable [ ^ ]
First of all your question is wrong as like as Sandeep said.

Alternatives to using a cursor:
- Use WHILE LOOPS
- Use temp tables
- Use derived tables
- Use correlated sub-queries
- Use the CASE statement
- Perform multiple queries


But Here I gave you the links for
"Alternatives for Cursors" & "Comparisons between those things" & "etc., things"

Comparing cursor vs. WHILE loop performance in SQL Server 2008[^]

Cursor vs While loop. What are advantage/disadvantages of cursors[^]

Cursor vs Temp Table vs Table Variable performance[^]

Performance Tuning SQL Server Cursors[^]

USING SQL SERVER 2000 TABLE VARIABLES
TO ELIMINATE THE NEED FOR CURSORS
[^]

SQL SERVER – Comparison : Similarity and Difference #TempTable vs @TempVariable[^]


您需要阅读花花公子!

如果您知道1、2和3.是什么,则几乎不需要2秒即可回复.此外,您应该至少了解1、2和3是什么.

2和3都不是游标做什么的地方.临时表的工作可以随时用游标代替.
You need to read on dude!

If you would have know what are 1, 2 & 3.. it would be hardly take 2 seconds to reply back. Further, you should have atleast Googled on what 1, 2 & 3 are.

2 & 3 are no where what a cursor does. Temporary tables work can be replaced by cursors at time.


这篇关于用临时y表替换光标,cte,查看的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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