Skip to content

Latest commit

 

History

History
90 lines (60 loc) · 3.51 KB

sysmail-delete-profileaccount-sp-transact-sql.md

File metadata and controls

90 lines (60 loc) · 3.51 KB
title description author ms.author ms.reviewer ms.date ms.service ms.subservice ms.topic f1_keywords helpviewer_keywords dev_langs
sysmail_delete_profileaccount_sp (Transact-SQL)
sysmail_delete_profileaccount_sp (Transact-SQL)
markingmyname
maghan
randolphwest
08/21/2024
sql
system-objects
reference
sysmail_delete_profileaccount_sp
sysmail_delete_profileaccount_sp_TSQL
sysmail_delete_profileaccount_sp
TSQL

sysmail_delete_profileaccount_sp (Transact-SQL)

[!INCLUDE SQL Server]

Removes an account from a Database Mail profile.

:::image type="icon" source="../../includes/media/topic-link-icon.svg" border="false"::: Transact-SQL syntax conventions

Syntax

sysmail_delete_profileaccount_sp { [ @profile_id = ] profile_id | [ @profile_name = ] 'profile_name' } ,
    { [ @account_id = ] account_id | [ @account_name = ] 'account_name' }
[ ; ]

Arguments

[ @profile_id = ] profile_id

The profile ID of the profile to delete. @profile_id is int, with a default of NULL. Either the @profile_id or the @profile_name can be specified.

[ @profile_name = ] 'profile_name'

The profile name of the profile to delete. @profile_name is sysname, with a default of NULL. Either the @profile_id or the @profile_name can be specified.

[ @account_id = ] account_id

The account ID to delete. @account_id is int, with a default of NULL. Either the @account_id or the @account_name can be specified.

[ @account_name = ] 'account_name'

The name of the account to delete. @account_name is sysname, with a default of NULL. Either the @account_id or the @account_name can be specified.

Return code values

0 (success) or 1 (failure).

Result set

None.

Remarks

Returns an error if the account specified isn't associated with the profile specified.

When an account is specified but no profile is specified, this stored procedure removes the specified account from all profiles. For example, if you're preparing to shut down an existing SMTP server, you remove accounts that use that SMTP server from all profiles, rather than removing each account from each profile.

When a profile is specified but no account is specified, this stored procedure removes all accounts from the specified profile. For example, if you're changing the SMTP servers a profile uses, it might be convenient to remove all accounts from the profile and then add new accounts as necessary.

The stored procedure sysmail_delete_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 isn't msdb.

Permissions

[!INCLUDE msdb-execute-permissions]

Examples

The following example shows removing the account Audit Account from the profile AdventureWorks Administrator.

EXEC msdb.dbo.sysmail_delete_profileaccount_sp
    @profile_name = 'AdventureWorks Administrator',
    @account_name = 'Audit Account';

Related content