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.

Syntax

sysmail_help_principalprofile_sp [ {   [ @principal_id = ] principal_id | [ @principal_name = ] ‘principal_name’ } ]

    [ [ , ] {   [ @profile_id = ] profile_id | [ @profile_name = ] ‘profile_name’ } ]

Arguments

@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’

sysmail_principalprofile_help

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

Advertisements

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s