sysmail_help_profileaccount_sp (Transact-SQL)
Lists the accounts associated with one or more Database Mail profiles.
Returns a result set with the following columns.
Column name | Data type | Description |
profile_id | int | The profile ID of the profile. |
profile_name | sysname | The name of the profile. |
account_id | int | The account ID of the account. |
account_name | sysname | The name of the account. |
sequence_number | int | The sequence number of the account within the profile. |
When no profile_id or profile_name is specified, this stored procedure returns information for every profile in the instance.
The stored procedure sysmail_help_profileaccount_sp is in the msdb database and is owned by the dbo schema. The procedure must be executed with a three-part name if the current database is not msdb.
A. Listing the accounts for a specific profile by name
The following example shows listing the information for the AdventureWorks Administrator profile by specifying the profile name.
EXECUTE msdb.dbo.sysmail_help_profileaccount_sp @profile_name = 'AdventureWorks Administrator'
Here is a sample result set, edited for line length:
profile_id profile_name account_id account_name sequence_number ----------- ---------------------------- ----------- -------------------- --------------- 131 AdventureWorks Administrator 197 Admin-MainServer 1 131 AdventureWorks Administrator 198 Admin-BackupServer 2
B. Listing the accounts for a specific profile by profile ID
The following example shows listing the information for the AdventureWorks Administrator profile by specifying the profile ID for the profile.
EXECUTE msdb.dbo.sysmail_help_profileaccount_sp
@profile_id = 131 ;
Here is a sample result set, edited for line length:
profile_id profile_name account_id account_name sequence_number ----------- ---------------------------- ----------- -------------------- --------------- 131 AdventureWorks Administrator 197 Admin-MainServer 1 131 AdventureWorks Administrator 198 Admin-BackupServer 2
C. Listing the accounts for all profiles
The following example shows listing the accounts for all profiles in the instance.
EXECUTE msdb.dbo.sysmail_help_profileaccount_sp
Here is a sample result set, edited for line length:
profile_id profile_name account_id account_name sequence_number ----------- ---------------------------- ----------- -------------------- --------------- 131 AdventureWorks Administrator 197 Admin-MainServer 1 131 AdventureWorks Administrator 198 Admin-BackupServer 2 106 AdventureWorks Operator 210 Operator-MainServer 1

