Hi friends, today in SQL Server System stored procedure series 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.
Syntax:
sysmail_add_profile_sp [ @profile_name = ] 'profile_name' [ , [ @description = ] 'description' ] [ , [ @profile_id = ] new_profile_id OUTPUT ]
Arguments:
@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 🙂
Regards,
Kapil Singh
Like us on FaceBook | Join the fastest growing SQL Server group on FaceBook