Guys,
I have a stored procedure along the following lines :
If I run each line of code in Query Analyzer, it takes 1min 40seconds in TOTAL (i.e. adding the times together that it takes to run each line).
But EXECuting the complete code as a stored procedure takes 25 minutes!!!!
Any ideas why?
Thanks!
Bob
I have a stored procedure along the following lines :
Code:
Create Procedure ProcedureName
AS
Create Table yyy (
IDField int,
Field1 varchar(50),
Field2 varchar(50),
Field3 varchar(50),
Fieldx...
etc...
)
Insert into Table yyy (IDField) SELECT ID from tblPPP where Surname='Smith'
UPDATE Table yyy SET Field1=value FROM tblQQQ WHERE tblQQQ.ID=IDField
UPDATE Table yyy SET Field2=value FROM tblRRR WHERE tblRRR.ID=IDField
UPDATE Table yyy SET Field3=value FROM tblSSS WHERE tblSSS.ID=IDField
UPDATE Table yyy SET Fieldx...
etc...
SELECT * FROM yyy
DROP TABLE yyy
If I run each line of code in Query Analyzer, it takes 1min 40seconds in TOTAL (i.e. adding the times together that it takes to run each line).
But EXECuting the complete code as a stored procedure takes 25 minutes!!!!
Any ideas why?
Thanks!
Bob