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

Author  Topic 

keithc1
Yak Posting Veteran

88 Posts

Posted - 2004-06-28 : 23:05:30
When is this global variable populated, is it specific to delete/insert/update statements?

I guess what i'm trying to figure out is how do I know when to use Raiserror instead of @@error?

Keithc MCSE MCSA

derrickleggett
Pointy Haired Yak DBA

4184 Posts

Posted - 2004-06-28 : 23:34:43
You use RAISERROR anytime @@error <> 0.

IF @@ERROR <> 0
BEGIN
RAISERROR('AHHHHHHHHHHHHHHHH, ITS TERRIBLE!!!!',16,1)
RETURN -1
END

MeanOldDBA
derrickleggett@hotmail.com

When life gives you a lemon, fire the DBA.
Go to Top of Page
   

- Advertisement -