Click here to Skip to main content
Click here to Skip to main content

Tagged as

Set global profile for mailing in Microsoft SQL Server 2008

, 13 Nov 2010
Rate this:
Please Sign up or sign in to vote.
Allows to set default mailing global profile with aid of T-SQL

You can get an error message like the following:

Msg 14636, Level 16, State 1, Procedure sp_send_dbmail, Line 112
No global profile is configured. Specify a profile name in the @profile_name parameter.

 

Yes. You forgot to set up default profile in Database Mail Configuration Wizard just like me. Smile | :) There is no simple way to correct this.

I checked sysmail_ stored procedures family on subject who is able to handle this situation. The most relevant one is sysmail_update_principalprofile_sp, but I dropped the idea to use it after the first failed attempt to do. I checked sysmail_ tables set instead. And I quickly found [msdb].[dbo].[sysmail_principalprofile] with is_default field in it.

This is T-SQL to set default mailing profile:

 
update [msdb].[dbo].[sysmail_principalprofile]
set is_default = 1
where profile_id =
      (select max(profile_id)
      from [msdb].[dbo].[sysmail_profile]
      where [name] = 'def_profile'
      )
 

From now annoying offer to specify a profile name in the @profile_name parameter disappeared.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

db_developer
Database Developer Freelancer
Ukraine Ukraine
MS SQL Server Database Developer with 7+ years experience
 
Technologies/languages: Business Intelligence, SQL, MDX, VBA, SQL Server, Analysis Services (SSAS), Reporting services (SSRS), Integration Services (SSIS), DataWarehouse.
Also: economic background.
 
Feel free to contact me for rates and details.

Comments and Discussions

 
GeneralGreat Article Pinmemberrohitkharbanda18-Mar-12 19:44 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Mobile
Web01 | 2.8.140821.2 | Last Updated 13 Nov 2010
Article Copyright 2010 by db_developer
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid