Re: RaiseError with @@ERROR as first parameter

From: Adam Machanic (amachanic_at_hotmail._removetoemail_.com)
Date: 11/04/04


Date: Thu, 4 Nov 2004 09:55:31 -0500

What is that code intended to do? Why would you want to raise an error
without checking to find out if there was an error? Also, even if RAISERROR
would let you do that, if there's no error it won't work -- the MsgId must
be greater than 13000.

-- 
Adam Machanic
SQL Server MVP
http://www.sqljunkies.com/weblog/amachanic
--
"ashwini" <rajashwini7@hotmail.com> wrote in message
news:42e59b86.0411040346.7738477@posting.google.com...
> Hi,
>
> Can anyone help me to use RaiseError with @@ERROR as the first parameter.
> Code in my stored procedure is,
>
> RAISERROR (@@ERROR,15,-1, @err_msg) WITH SETERROR
>
> On SQL Server 2000 i am getting the compilation error saying
> "Incorrect syntax near '@@ERROR'" though this works on Sql server 7.
>
> I can not change the stored procedure code.. Is there any way of setting
up
> environment variable or any other method by which I could resolve this
problem
> without modifying the stored procedure.
>
> Thanks in advance.


Relevant Pages

  • Re: How to retrieve StoredProc raiserror code?
    ... Since it does a raiserror, it wouldn't GET to the return. ... missing something. ... It is just like doing a raise Exception.Create in a ... If your stored procedure uses a Return parameter you just examine the ...
    (borland.public.delphi.database.ado)
  • Re: Stored procedure truncating parameters?
    ... I don't think he can raise an error. ... I believe the stored procedure ... will truncate the data on the way in, before he can access it and check its ... SQL Server MVP ...
    (microsoft.public.sqlserver.programming)
  • RaiseError with @@ERROR as first parameter
    ... RAISERROR WITH SETERROR ... "Incorrect syntax near '@@ERROR'" though this works on Sql server 7. ... I can not change the stored procedure code.. ...
    (microsoft.public.sqlserver)
  • RaiseError with @@ERROR as first parameter
    ... RAISERROR WITH SETERROR ... "Incorrect syntax near '@@ERROR'" though this works on Sql server 7. ... I can not change the stored procedure code.. ...
    (microsoft.public.sqlserver.programming)
  • Re: How to get list of EventClasses in MSSQLServer2000
    ... statement inside a stored procedure has completed.') ... SQL Server statement or stored procedure.') ... Plan','Displays the plan tree of the Transact-SQL statement executed.') ... Login','Occurs when a SQL Server login is added or removed; ...
    (microsoft.public.sqlserver.security)