I have a performance problem
I need to run a Stored Procedure from .Net 1.1. This stored procedure calls 8 Stored Procedures. Each one of them process information to throw a comparative between old an new informacion and anter afects the physical table in DataBase.
The problem comes since I try to run it directly from SSMS. Servers starts crashing, getting so slow and almost impossible to work. I think infrastructure people has to restar service directly on the server.
I'm working in development enviroment so there is no much problem, but I can't upload this into production enviroment.
I've been thinking in use procedures only for comparison purposes and never affect physical data. Retrive information from them in Temporary tables in principal procedure and then open my try-catch and begin-end transactions blocks and affect database in my principal stored with the informacion in Temp tables.
My principal stored look as follows: Is this the best way I can do this??
create proc spTest
as
/*Some processes here, temporary tables, etc...*/
begin try
begin distributed transaction
sp_nested1
sp_nested2
sp_nested3
sp_nested4
sp_nested5
sp_nested6
sp_nested7
sp_nested8
/*more processes here, updates, deletes, extra inserts, etc...*/
commit transaction
end try
begin catch
rollback transaction
DECLARE @ERROR VARCHAR(3000)
SELECT @ERROR = CONVERT(VARCHAR(3000),ERROR_MESSAGE())
RAISERROR(@ERROR,16,32)
RETURN
end catch
The basic structure of each nested stored proc is similar but doesn't call any other proc, only each one has their own try and catch blocks.
Any help will be really appreciated... The version Im using is SQL Server 2005
Thank you all in advance....