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.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Getting Stored proc error

Author  Topic 

rj_khatri
Starting Member

13 Posts

Posted - 2002-07-08 : 00:41:58
Amiable friends,
Hi There!

One of my application calls a stored procedure, which in turns calls other 5 procedures. While it is executed, it gives me error.
How can i know where the problem is being occured out of these 6 stored procedures.
Thanx in advance


Rajesh Khatri

rksingh024
Yak Posting Veteran

56 Posts

Posted - 2002-07-08 : 00:53:01
Hi,
Just check the return value of the each SP, if the value is <> 0 then there is a error. print some appropriate message and exit from the SP.

e.g.

declare @retval int
select @retval = 0

exec @retval = SP_1 (param1,...,paramn)
IF @retval <> 0
begin
print 'Error in the SP_1'
return
end

Ramesh
Go to Top of Page

anupgupta
Starting Member

2 Posts

Posted - 2002-07-08 : 00:57:04
Stored Procedure in SQL Server returns an integer value, 0 for success.
where you are calling 5 SPs , after each call, print its value and some error message..
Also you can return error codes from your SPs and chek there value, by that you can get to know where exactly are you getting the problem.

Regards,
Anup Gupta

Go to Top of Page
   

- Advertisement -