|
Posted by Erland Sommarskog on 06/18/07 22:34
Uncle Rico (Uncle.Rico291@gmail.com) writes:
> HI IS THERE A WAY TO GET MY PROC FASTER IT RUNS OK NOW BUT I JUST NEED
> IT FASTER THANKS.
It's a very long procedure, and without knowledge of the tables etc,
I don't think you should expect this audience to put the magic finger
on the sensitive spot.
In general: you are using cursors, and cursors are often a recipe for
slow-running code. I did not analyse what you cursors are doing, but you
could try replacing them with set-based operations. If you keep the cursors,
put INSENSITIVE before the CURSOR keyword. This can sometimes help.
Even more general: it's pointless trying to look at this beast as a whole.
Use the SQL Server Profiler, to track down what in the procedure that is
stealing time. Maybe it's just a single statement. Then you can fight
with that statement.
--
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx
[Back to original message]
|