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
 Transact-SQL (2000)
 Error Handling and Stored Procedure...

Author  Topic 

nqhernandez
Starting Member

1 Post

Posted - 2008-03-16 : 02:06:57
I have a problem..
I created a stored procedure. But everytime I test it It seems like it doesnt work..

i used @@error for that particular error..

This is the last part of my syntax
-------------------------
DECLARE @err INT

SET @err = @@ERROR
IF @err <> 0
BEGIN
IF @err = 513
RAISERROR('What The Hell Man!!',16,1)
ELSE
RAISERROR('An unspecified error has occurred.',10,1)
RETURN @err
END
ELSE
RETURN 0
GO
--------------------------------

but everytime I tried to trigger that error 513, the raise error statement does'nt come up...

jonasalbert20
Constraint Violating Yak Guru

300 Posts

Posted - 2008-03-17 : 06:58:21
[code]
SET @err = @@ERROR
IF @err <> 0

BEGIN
IF @err = 513
RAISERROR('What The Hell Man!!',16,1)
ELSE
RAISERROR('An unspecified error has occurred.',10,1)
RETURN @err
END

ELSE
RETURN 0
GO
[/code]


perhaps it does not go to your error checking routine or you forgot to put SET NOCOUNT OFF on your stored procedure so that error will come up.

For fast result follow this...
http://weblogs.sqlteam.com/brettk/archive/2005/05/25.aspx

Want Philippines to become 1st World COuntry? Go for World War 3...
Go to Top of Page
   

- Advertisement -