Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

where can I query the 'Enable Mail Profile' value from the Agent properties Expand / Collapse
Author
Message
Posted Thursday, May 1, 2014 8:31 PM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Monday, June 9, 2014 11:35 PM
Points: 27, Visits: 86
Hi All,

I'm looking to query (via SQL) the 'Enable Mail Profile' value from the Agent properties, but I've been unable to find the appropriate view.

http://technet.microsoft.com/en-us/library/ms181367.aspx lists the SQL Server Agent Tables, but I haven't been able to find anything enlightening.

Thanks in advance
Simon.
Post #1566905
Posted Friday, May 2, 2014 12:19 AM
SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Monday, July 21, 2014 2:56 AM
Points: 2,603, Visits: 2,061
You can use following:

EXEC msdb.dbo.sp_set_sqlagent_properties @databasemail_profile=N''

HTH


---------------------------------------------------
"Thare are only 10 types of people in the world:
Those who understand binary, and those who don't."
Post #1566931
Posted Friday, May 2, 2014 11:06 AM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: 2 days ago @ 9:07 AM
Points: 11,157, Visits: 12,899
I believe this is stored in the registry. If you view the source of EXEC msdb.dbo.sp_set_sqlagent_properties all the properties are stored in the registry.



Jack Corbett

Applications Developer

Don't let the good be the enemy of the best. -- Paul Fleming

Check out these links on how to get faster and more accurate answers:
Forum Etiquette: How to post data/code on a forum to get the best help
Need an Answer? Actually, No ... You Need a Question
How to Post Performance Problems
Crosstabs and Pivots or How to turn rows into columns Part 1
Crosstabs and Pivots or How to turn rows into columns Part 2
Post #1567128
Posted Sunday, May 4, 2014 5:09 PM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Monday, June 9, 2014 11:35 PM
Points: 27, Visits: 86
Thanks Guys,

Interesting but not really what I'm after.

To put it another way.

My Problem - I found one of my servers had the Agent Mail Profile unchecked, and it wasn't sending emails about failed jobs.

I'd like to programatically check all my database servers to find any others which may be wrong.

Any other ideas ?

Thanks
Simon.
Post #1567375
Posted Sunday, May 4, 2014 9:03 PM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Monday, June 9, 2014 11:35 PM
Points: 27, Visits: 86
OK, You lead me to a solution.


declare @val nvarchar(4000) 

exec master.dbo.xp_instance_regread
N'HKEY_LOCAL_MACHINE',
N'Software\Microsoft\MSSQLServer\SQLServerAgent',
N'DatabaseMailProfile',
@val output
select @val


I did a file compare of that registry key (exported) and the only diff between having the checkbox checked or not is the 'DatabaseMailProfile'

"DatabaseMailProfile"="DBA Profile"
vs.
"DatabaseMailProfile"=""

Thanks heaps
Simon.
Post #1567398
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse