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)
 Error handling in Catch block.

Author  Topic 

Hariarul
Posting Yak Master

160 Posts

Posted - 2006-11-07 : 01:51:53
Hi all,

BEGIN CATCH
SET @var = 5
RAISERROR(50005,16,1)
ROLLBACK TRANSACTION
END CATCH


Is the above code for Error handling inside catch block correct ? Raiserror should come first or rollback ?

Thanks in advance,

HHA

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2006-11-07 : 01:56:03
I think you have to use the TRY keyword too.


Peter Larsson
Helsingborg, Sweden
Go to Top of Page

Hariarul
Posting Yak Master

160 Posts

Posted - 2006-11-07 : 02:03:54
Sorry Peso , I just pasted the code in the CATCH block. I do have the TRY block. Please let me know the order in CATCH block is ok ?
Go to Top of Page

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2006-11-07 : 02:27:27
Does it matter? Anyway Rollback Transaction will be executed, right?

Harsh Athalye
India.
"Nothing is Impossible"
Go to Top of Page
   

- Advertisement -