Hi,
I have trouble getting the alerts to work on SQL 2005.
Below I define a custom message and a custom alert.
When I raise the error though the alert never fires.
Any ideas why that would be?
Thanks,
Patrick
----
USE master
GO
EXEC sp_addmessage 50001, 16, N'The version of SQL Server has been
requested.'
GO
---
USE [msdb]
GO
EXEC msdb.dbo.sp_add_alert @.name=N'TEST Alert',
@.message_id=50001,
@.severity=0,
@.enabled=1,
@.delay_between_responses=5,
@.include_event_description_in=5,
@.notification_message=N'TEST',
@.category_name=N'[Uncategorized]',
@.job_id=N'00000000-0000-0000-0000-000000000000'
---
RAISERROR (50001, 16, 1)
---On sp_addmessage set @.with_log to true, the default is false.
Hope this helps,
Ben Nevarez
"Patrick" wrote:
> Hi,
> I have trouble getting the alerts to work on SQL 2005.
> Below I define a custom message and a custom alert.
> When I raise the error though the alert never fires.
> Any ideas why that would be?
> Thanks,
> Patrick
> ----
> USE master
> GO
> EXEC sp_addmessage 50001, 16, N'The version of SQL Server has been
> requested.'
> GO
> ---
> USE [msdb]
> GO
> EXEC msdb.dbo.sp_add_alert @.name=N'TEST Alert',
> @.message_id=50001,
> @.severity=0,
> @.enabled=1,
> @.delay_between_responses=5,
> @.include_event_description_in=5,
> @.notification_message=N'TEST',
> @.category_name=N'[Uncategorized]',
> @.job_id=N'00000000-0000-0000-0000-000000000000'
> ---
> RAISERROR (50001, 16, 1)
> ---
>|||On Jan 29, 4:06 pm, Ben Nevarez
<bneva...@.no.spam.please.sunamerica.com> wrote:
> On sp_addmessage set @.with_log to true, the default is false.
> Hope this helps,
> Ben Nevarez
Hi Ben,
thanks that worked. Maybe you would also know why none of my
replication alerts is working.
They are all set up but when I look on the history section of each
alert none of them has ever been called (even though we are using
replication :))
Thanks,
Patricksql
Showing posts with label raise. Show all posts
Showing posts with label raise. Show all posts
Tuesday, March 20, 2012
Thursday, February 16, 2012
After RAISERROR executes next line.
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
>
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
>
After RAISERROR executes next line.
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 goe
s
>to the called program.
>Thanks in advance,
>Prasanth
>
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 goe
s
>to the called program.
>Thanks in advance,
>Prasanth
>
After RAISERROR executes next line.
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
RAISERROR('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
>
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
RAISERROR('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:
Posts (Atom)