Re: STORED PROCEDURE IF STATEMENT

Tech-Archive recommends: Speed Up your PC by fixing your registry

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


Date: Wed, 21 Jul 2004 09:13:17 -0400

I'd just like to stress a point from Roji's comment: @@ERROR will only look
at errors from a statement that IMMEDIATELY precedes it. Putting this at
the bottom of a sproc will have little (or no) benefit if there is more than
one statement executed in the sproc.

Is the client actually checking for return values?

"Stephen" <Stephen@discussions.microsoft.com> wrote in message
news:002A1C52-1559-4574-9774-7F1DFD5AAD98@microsoft.com...
> Im recently started using stored procedures and have inherited many for a
project im taking part in. I'm having difficulty working out all of the
statements tho. Could someone please tell me what the following means when
it is placed at the bottom of a stored procedure.
>
> IF @@ERROR = 0
> RETURN 1
> ELSE
> RETURN 0
>
> Im not a programmer and so am a little confused as to exactly what this is
doing.



Relevant Pages

  • Re: Distributed queries
    ... I myself have no problem with the practice of a sproc getting data from ... The BLL approach is nice, because as you say, it is obvious. ... database deployments is that the network is not free. ... > the question really comes down to using stored procedures or .Net code to> implement our business logic. ...
    (microsoft.public.dotnet.distributed_apps)
  • Truncating Parameters in VS.Net 2003
    ... I have some stored procedures that accept a text parameter ... Right Click on sproc in VS.Net Server Explorer. ... but SQL Profiler shows truncated parameter. ...
    (microsoft.public.vsnet.ide)
  • Re: Complex Database Transactions
    ... Yes, stored procedures can offer a performance benefit, mainly because ... the code is executing on the server, ... If your sproc ... But if you have multiple operations and/or ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: Supporting multiple database
    ... [Connecting to multiple databases] ... stored procedures, and have ported each sproc to: ...
    (microsoft.public.dotnet.languages.vb)