Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
Vijaykumar_Patil
Posting Yak Master
121 Posts |
Posted - 2007-05-18 : 09:36:45
|
| Hi all,I have a task of rewriting all the old procs which were build on cursors, the management does want me to remove the cursor completely since that would mean rewriting everthing.. they want to use a temp table and run a cursor on the temp table. Since there are many cursors in each proc. Any suggestions on to go about it. I am against the use of cursor any everywhere in it , even if it calls for rewriting the whole db again.I did some tests on running the old proc and the semi new proc , which runs a cursor from the temp table for the cursor query. And it even bad than the cursor only. what does this mean? Is it really a very bad idea to run cursor on a temp table?Necessity is the mother of all inventions! |
|
|
DonAtWork
Master Smack Fu Yak Hacker
2167 Posts |
Posted - 2007-05-18 : 09:41:07
|
| cursor = bad ideacursor + more = worse idea[Signature]For fast help, follow this link:http://weblogs.sqlteam.com/brettk/archive/2005/05/25.aspxLearn SQLhttp://www.sql-tutorial.net/ http://www.firstsql.com/tutor.htm http://www.w3schools.com/sql/default.asp |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2007-05-18 : 11:30:16
|
| If possible you can rewrite cursor with set based approachPost one of the procedures and someone may give you idea on how to avoid cursorMadhivananFailing to plan is Planning to fail |
 |
|
|
X002548
Not Just a Number
15586 Posts |
|
|
cvraghu
Posting Yak Master
187 Posts |
Posted - 2007-05-18 : 13:37:36
|
| I've seen code which tries to replace cursor by creating temp table with identity column and using a while loop. But not cursor on the temp table again. Using while loop is also not beneficial always - http://www.sqlteam.com/Forums/topic.asp?TOPIC_ID=44214 |
 |
|
|
|
|
|