Development · Stored Procedure

Sysmail_add_profile_sp – SQL Server Database Mail Stored Procedure – Part 3

Hi friends, today we will continue with database mail stored procedure sysmail_add_profile_sp.

Sysmail_add_profile_Sp stored procedure is used to create database mail profile. A database mail profile can hold multiple database mail accounts. Database mail profile name must be unique for Microsoft SQL Server Database Engine. This stored procedure is stored in msdb database and owned by schema dbo.


sysmail_add_profile_sp [ @profile_name = ] ‘profile_name’

[ , [ @description = ] ‘description’ ]

[ , [ @profile_id = ] new_profile_id OUTPUT ]


@profile_name is the name of new database mail profile.

@description is the description for new profile having datatype nvarchar (256).

@profile_id is the ID of new profile having datatype int.

Let’s, execute the following code to create the new database mail profile:

EXECUTE msdb.dbo.sysmail_add_profile_sp

       @profile_name = ‘Database Test Mail’,

       @description = ‘Profile for Test mail.’;

So, a new database mail profile is created and we can check information related to this in stored procedure sysmail_help_profile_sp.

EXEC msdb.dbo.sysmail_help_profile_sp


That’s all for the day friends. We will continue with another database mail stored procedure in next post. Have a nice day 🙂


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s