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)
 Retrieve @ERROR value

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2003-02-03 : 08:54:23
Mahesh writes "Hi,

I have a stored procedure which executes some SQL statements. I want to retrieve the error ( the value of @ERROR ) using my ASP script. Also i would like to know how can i catch the error thrown by RAISERROR() function in stored procedure using my ASP Script .

Thanking You
Mahesh"

SamC
White Water Yakist

3467 Posts

Posted - 2003-02-03 : 18:59:44
You need to capture @@ERROR immediately after each statement

INSERT ... whatever
SET @Err = @@ERROR


You can pass the error back to ASP using

RETURN(@Err)

Look at the articles on retrieving OUTPUT variable for an explanation on retrieving RETURN values.

Your errors are also returned in the command object to ASP. The kind of error capture above is usually used to perform conditional execution inside a stored procedure.

Sam

Go to Top of Page
   

- Advertisement -