May 1, 2014 at 8:31 pm
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.
May 2, 2014 at 12:19 am
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."
May 2, 2014 at 11:06 am
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
Consultant - Straight Path Solutions
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
May 4, 2014 at 5:09 pm
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.
May 4, 2014 at 9:03 pm
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.
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply