Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
dbthj
Posting Yak Master
143 Posts |
Posted - 2008-11-25 : 11:59:03
|
I am trying to standardize my shop's approach to email alertsby creating a script that sets up Database Mail using parameterized stored procedures. Predefining parameter values works finefor these :sp_add_operator , sysmail_add_profile_sp ,andsysmail_add_account_sp but it fails for sysmail_add_profileaccount_sp. I get a datatype conversion error. I don't see where the conversion is attempted.Here are 3 examples of this command. #1 works, but I don't want to hard-code the values. I want to preset the values.--=============================================== -- #1 This works but I DON'T WANT TO DO THIS. EXECUTE msdb.dbo.sysmail_add_profileaccount_sp @profile_name = 'MyServerSQL2005AlertProfile' , @account_name = 'MyServerDBSAlertAccount' , @sequence_number = 1 ; --================================================-- #2 This Failsdeclare @profile_name sysnamedeclare @account_name sysnamedeclare @sequence_number intset @sequence_number = 1 set @account_name = 'MyServerDBSAlertAccount' set @profile_name = 'MyServerSQL2005AlertProfile' EXECUTE msdb.dbo.sysmail_add_profileaccount_sp @profile_name , @account_name , @sequence_number ; ERROR MESSAGE: Msg 8114, Level 16, State 1, Procedure sysmail_add_profileaccount_sp, Line 0Error converting data type nvarchar to int.--================================================-- #3 This Failsdeclare @profile_name sysnamedeclare @account_name sysnameset @account_name = 'MyServerDBSAlertAccount' set @profile_name = 'MyServerSQL2005AlertProfile' EXECUTE msdb.dbo.sysmail_add_profileaccount_sp @profile_name , @account_name , @sequence_number = 1 ; ERROR MESSAGE: Msg 8114, Level 16, State 1, Procedure sysmail_add_profileaccount_sp, Line 0Error converting data type nvarchar to int.--=========================================== |
|
sodeep
Master Smack Fu Yak Hacker
7174 Posts |
Posted - 2008-11-25 : 13:36:04
|
What are trying to alert ? Didn't get it? |
 |
|
dbthj
Posting Yak Master
143 Posts |
Posted - 2008-11-25 : 14:11:39
|
I am setting up the operatorprofileaccountput the account in the profileset the profile to defaultAll with standard names. That means a script.That means use the sysmail SP's and set the parametervalues without using literals.Then I can set up jobs and maintenance plans to send email alerts to theDBAs when things go kabloooey. |
 |
|
|
|
|
|
|