x

How to get SQL Server available alerts infomation ?

Hi,

Am looking SQL query to get all available server alerts information including- db_name, and all related information about alerts

more ▼

asked Apr 24 '12 at 08:41 AM in Default

Amardeep gravatar image

Amardeep
1.3k 84 88 89

Did you mean [sysalerts][1] table in msdb database?

[1]: http://msdn.microsoft.com/en-us/library/ms187814.aspx
Apr 24 '12 at 09:29 AM Cyborg
(comments are locked)
10|1200 characters needed characters left

1 answer: sort voted first

Alerts information is stored in the msdb database. Here is a sample query to get a little information about alerts on your system:

SELECT  SA.name AlertName,
        SC.name AlertCategory,
        SJ.name JobName,
        SO.name OperatorName,
        SO.email_address OperatorEmailAddress
FROM    dbo.sysalerts AS SA
LEFT JOIN dbo.sysjobs AS SJ ON SA.job_id = SJ.job_id
LEFT JOIN dbo.sysnotifications AS SN ON SN.alert_id = SA.id
LEFT JOIN dbo.sysoperators AS SO ON SO.id = SN.operator_id
LEFT JOIN dbo.syscategories AS SC ON SC.category_id = SA.category_id
Be aware that the designer of the tables in msdb (not just alerts) decided to store date and time information as ints. You will need to consider that when wanting to do date comparisons or conversions.
more ▼

answered Apr 24 '12 at 09:42 AM

WilliamD gravatar image

WilliamD
25.8k 17 19 41

(comments are locked)
10|1200 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

New code box

There's a new way to format code on the site - the red speech bubble logo will automatically format T-SQL for you. The original code box is still there for XML, etc. More details here.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

SQL Server Central

Need long-form SQL discussion? SQLserverCentral.com is the place.

Topics:

x1816
x11

asked: Apr 24 '12 at 08:41 AM

Seen: 1158 times

Last Updated: Apr 24 '12 at 10:57 AM