sysmail_update_principalprofile_sp (Transact-SQL)
Updates the information for an association between a principal and a profile.
This stored procedure changes whether the profile specified is the default profile for the database user. A database user may only have one default private profile.
When the principal name for the association is public or the principal id for the association is 0, this stored procedure changes the public profile. There can only be one default public profile.
When @is_default is '1' and the principal is associated with more than one profile, the specified profile becomes the default profile for the principal. The profile that was previously the default profile is still associated with the principal, but is no longer the default profile.
The stored procedure sysmail_update_principalprofile_sp is in the msdb database and is owned by the dbo schema. The procedure must be executed with a three-part name if the current database is not msdb.
A. Setting a profile to be the default public profile for a database
The following example sets the profile General Use Profile to be the default public profile for users in the msdb database.
EXECUTE msdb.dbo.sysmail_update_principalprofile_sp
@principal_name = 'public',
@profile_name = 'General Use Profile',
@is_default = '1';
B. Setting a profile to be the default private profile for a user
The following example sets the profile AdventureWorks Administrator to be the default profile for the principal ApplicationUser in the msdb database. The profile must already be associated with the principal. The profile that was previously the default profile is still associated with the principal, but is no longer the default profile.
EXECUTE msdb.dbo.sysmail_update_principalprofile_sp
@principal_name = 'ApplicationUser',
@profile_name = 'AdventureWorks Administrator',
@is_default = '1' ;
