Sysmail_help_principalprofile_sp – Day 19 – SQL Server System Stored Procedure

Hi friends, in this blog of SQL Server system stored procedure we will continue with another database mail stored procedure sysmail_help_principalprofile_sp.

Sysmail_help_principalprofile_sp stored procedure list the information about associations between database mail profile and database principals.

When sysmail_help_principalprofile_sp stored procedure is executed without any parameters then it returned lists all of the associations in the instance of SQL Server.


sysmail_help_principalprofile_sp [ {   [ @principal_id = ] principal_id | [ @principal_name = ] 'principal_name' } ]

    [ [ , ] {   [ @profile_id = ] profile_id | [ @profile_name = ] 'profile_name' } ]


@principal_Id – ID of the database user or role in msdb database.

@principal_name – Name of the database user or role in msdb database. Either @principal_id or @principal_name is necessary to specify.

@profile_id – Id of the database mail profile.

@profile_name – Name of the database mail profile. Either @profile_id or @profile_name must be specified.

Now let’s execute the below stored procedure by passing database profile name in parameters:

EXEC msdb.dbo.sysmail_help_principalprofile_sp@profile_name = 'Database Test Mail'


Similarly when we executed this stored procedure without passing any parameters it will return list of all association in instance of SQL Server.

 EXEC msdb.dbo.sysmail_help_principalprofile_sp

That’s all friends for the day 🙂



Kapil Singh

Like us on FaceBook | Join the fastest growing SQL Server group on FaceBook 


About Kapil Singh Kumawat

Kapil Singh Kumawat has been working with SQL Server since last 5 years. He is from Jaipur, Rajasthan, India and currently working with Cognizant Technology Solutions as SQL Server Developer. He has good experience in performance tuning, SSIS, data migration and data designing. Apart from database he has interest in travelling, watching football and listening music.

View all posts by Kapil Singh Kumawat →

Leave a Reply

Your email address will not be published.