May 20, 2011 at 4:56 am
Remove cursors without using while loop
May 20, 2011 at 5:05 am
We can't do that unless we see the rest of the code and the code of the calling objects.
May 20, 2011 at 5:33 am
yep Ninja's right; the key is the procedure usp_generate_purchase_order and the code you commented out ; whatever it is doing to a single set of parameters needs to be moved into a set based command...
can't suggest anything until we see what that does.
Lowell
May 20, 2011 at 6:32 am
Thanks for your responce. actually i copied somewhere that above code.
May 20, 2011 at 6:40 am
mahe2682 (5/20/2011)
...can u help me for this.
...
Look up the OUTPUT clause in Books Online.
For better assistance in answering your questions, please read this[/url].
Hidden RBAR: Triangular Joins[/url] / The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url] Jeff Moden[/url]
May 20, 2011 at 6:45 am
There's no way I'd ever do that job from a forum.
Hire pro.
May 20, 2011 at 6:50 am
Ninja's_RGR'us (5/20/2011)
There's no way I'd ever do that job from a forum.Hire pro.
It's not as tough as it looks Ninja - it's an INSERT from a SELECT, OUTPUTting the new ID's which are then used for an UPDATE. Providing OP grasps OUTPUT, job done. If not, hire pro 😉
For better assistance in answering your questions, please read this[/url].
Hidden RBAR: Triangular Joins[/url] / The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url] Jeff Moden[/url]
May 20, 2011 at 6:54 am
I think Chris is right. You could output the fields you need into a temp table and use that to perform the update. Can you provide some table layouts, sample data and what you would expect the results to be?
For better, quicker answers, click on the following...
http://www.sqlservercentral.com/articles/Best+Practices/61537/
For better answers on performance questions, click on the following...
http://www.sqlservercentral.com/articles/SQLServerCentral/66909/
May 20, 2011 at 6:57 am
ChrisM@home (5/20/2011)
Ninja's_RGR'us (5/20/2011)
There's no way I'd ever do that job from a forum.Hire pro.
It's not as tough as it looks Ninja - it's an INSERT from a SELECT, OUTPUTting the new ID's which are then used for an UPDATE. Providing OP grasps OUTPUT, job done. If not, hire pro 😉
I'm not touching a wire banking system without making sure the changes are correct ;-).
May 20, 2011 at 7:03 am
...buth this random guy on the interwebz gave me the code to make this run faster ...what do you mean the numbers are off?...
Lowell
May 20, 2011 at 7:06 am
I agree. While I could certainly rewrite the code, I wouldn't want to touch a banking system without a lot more information on what this does and why.
- Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
Property of The Thread
"Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon
May 20, 2011 at 7:13 am
Lowell (5/20/2011)
...buth this random guy on the interwebz gave me the code to make this run faster ...what do you mean the numbers are off?...
Never a better time to say this>
Put your money where you mouth is :w00t:!
May 20, 2011 at 7:20 am
Ninja's_RGR'us (5/20/2011)
ChrisM@home (5/20/2011)
Ninja's_RGR'us (5/20/2011)
There's no way I'd ever do that job from a forum.Hire pro.
It's not as tough as it looks Ninja - it's an INSERT from a SELECT, OUTPUTting the new ID's which are then used for an UPDATE. Providing OP grasps OUTPUT, job done. If not, hire pro 😉
I'm not touching a wire banking system without making sure the changes are correct ;-).
Neither am I - hence the suggestion rather than code 😎
For better assistance in answering your questions, please read this[/url].
Hidden RBAR: Triangular Joins[/url] / The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url] Jeff Moden[/url]
May 20, 2011 at 7:32 am
I tried to myself and removed the cursors. but I wants to do without while loop also
May 20, 2011 at 7:36 am
Have you read any of the comments that have been posted to this thread?:ermm:
For better, quicker answers, click on the following...
http://www.sqlservercentral.com/articles/Best+Practices/61537/
For better answers on performance questions, click on the following...
http://www.sqlservercentral.com/articles/SQLServerCentral/66909/
Viewing 15 posts - 1 through 15 (of 23 total)
You must be logged in to reply to this topic. Login to reply