Skip to content

Latest commit

 

History

History
82 lines (58 loc) · 2.99 KB

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

File metadata and controls

82 lines (58 loc) · 2.99 KB
title description author ms.author ms.reviewer ms.date ms.service ms.subservice ms.topic f1_keywords helpviewer_keywords dev_langs
sysmail_delete_account_sp (Transact-SQL)
Deletes a Database Mail SMTP account.
markingmyname
maghan
randolphwest
05/30/2023
sql
system-objects
reference
sysmail_delete_account_sp
sysmail_delete_account_sp_TSQL
sysmail_delete_account_sp
TSQL

sysmail_delete_account_sp (Transact-SQL)

[!INCLUDE SQL Server - ASDBMI]

Deletes a Database Mail SMTP account. You can also use the Database Mail Configuration Wizard to delete an account.

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

Syntax

sysmail_delete_account_sp { [ @account_id = ] account_id | [ @account_name = ] 'account_name' }
[ ; ]

Arguments

[ @account_id = ] account_id

The ID number of the account to delete. @account_id is int, with no default. Either @account_id or @account_name must be specified.

[ @account_name = ] 'account_name'

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

Return code values

0 (success) or 1 (failure).

Result set

None.

Remarks

This procedure deletes the account specified, regardless of whether the account is in use by a profile. A profile that contains no accounts can't successfully send e-mail.

The stored procedure sysmail_delete_account_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 deleting the Database Mail account named AdventureWorks Administrator.

EXEC msdb.dbo.sysmail_delete_account_sp
    @account_name = 'AdventureWorks Administrator';

Related content