Hello,
I am trying to raise an error in MS SQL Server 2000 using the lines
if x = 1
raiserror('Error Message', 10, 1)
print 'Next Line.'
But, on execution, it shows the error message and goes to the next line.
(prints 'Next Line')
How do I set up the server so that after raising the error, the control goes
to the called program.
Thanks in advance,
PrasanthRAISERROR('blah...',10,1)
RETURN
--
http://www.aspfaq.com/
(Reverse address to reply.)
"Prasanth" <Prasanth@.discussions.microsoft.com> wrote in message
news:895177B6-342D-4F65-8D66-4177C56B8F6E@.microsoft.com...
> Hello,
> I am trying to raise an error in MS SQL Server 2000 using the lines
> if x = 1
> raiserror('Error Message', 10, 1)
> print 'Next Line.'
> But, on execution, it shows the error message and goes to the next line.
> (prints 'Next Line')
> How do I set up the server so that after raising the error, the control
goes
> to the called program.
> Thanks in advance,
> Prasanth|||Hi Prasanth
If I understand you correctly you want to raise an exception so that the
print statement is NOT executed?. Is this correct?
Yours Sincerely
Thomas Kejser
"Prasanth" <Prasanth@.discussions.microsoft.com> wrote in message
news:895177B6-342D-4F65-8D66-4177C56B8F6E@.microsoft.com...
> Hello,
> I am trying to raise an error in MS SQL Server 2000 using the lines
> if x = 1
> raiserror('Error Message', 10, 1)
> print 'Next Line.'
> But, on execution, it shows the error message and goes to the next line.
> (prints 'Next Line')
> How do I set up the server so that after raising the error, the control
> goes
> to the called program.
> Thanks in advance,
> Prasanth|||To put Aaron's suggestion in context:
declare @.x int
set @.x = 1 -- test with @.x = 2 also
if @.x = 1 begin
raiserror('Error Message', 10, 1)
return
end
print 'Next Line.'
Steve Kass
Drew University
Prasanth wrote:
>Hello,
>I am trying to raise an error in MS SQL Server 2000 using the lines
> if x = 1
> raiserror('Error Message', 10, 1)
> print 'Next Line.'
>But, on execution, it shows the error message and goes to the next line.
>(prints 'Next Line')
>How do I set up the server so that after raising the error, the control goes
>to the called program.
>Thanks in advance,
>Prasanth
>
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment