Click here to Skip to main content
12,694,121 members (33,635 online)
Click here to Skip to main content
Add your own
alternative version

Tagged as


4 bookmarked

Set global profile for mailing in Microsoft SQL Server 2008

, 13 Nov 2010 CPOL
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. :) 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.


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


About the Author

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.

You may also be interested in...

Comments and Discussions

GeneralGreat Article Pin
rohitkharbanda18-Mar-12 20:44
memberrohitkharbanda18-Mar-12 20:44 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    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 | Terms of Use | Mobile
Web01 | 2.8.170118.1 | Last Updated 13 Nov 2010
Article Copyright 2010 by db_developer
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid