Posted in Stored Procedure

Sysmail_help_principalprofile_sp – SQL Server Database Mail Stored Procedure – Part 10

Hi friends, in this blog of SQL Server  database mail 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 J


I am Kapil Singh Kumawat working on SQL Server since last 5 years. I am from Jaipur, Rajasthan, India and currently working in Cognizant Technology Solutions as SQL Server Developer. I have a good experience in writing queries, performance tuning, SSIS, SSAS, Power BI, Data migration and database designing. Apart from database I have interest in travelling,watching football and listening music. My blogs are also published on

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