Skip to content

Latest commit

 

History

History
77 lines (52 loc) · 2.7 KB

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

File metadata and controls

77 lines (52 loc) · 2.7 KB
title description author ms.author ms.reviewer ms.date ms.service ms.subservice ms.topic f1_keywords helpviewer_keywords dev_langs
sysmail_delete_profile_sp (Transact-SQL)
Deletes a mail profile used by Database Mail.
markingmyname
maghan
randolphwest
05/30/2023
sql
system-objects
reference
sysmail_delete_profile_sp
sysmail_delete_profile_sp_TSQL
sysmail_delete_profile_sp
TSQL

sysmail_delete_profile_sp (Transact-SQL)

[!INCLUDE SQL Server]

Deletes a mail profile used by Database Mail.

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

Syntax

sysmail_delete_profile_sp { [ @profile_id = ] profile_id | [ @profile_name = ] 'profile_name' }
[ ; ]

Arguments

[ @profile_id = ] profile_id

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

[ @profile_name = ] 'profile_name'

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

Return code values

0 (success) or 1 (failure).

Result set

None.

Remarks

Deleting a profile doesn't delete the accounts used by the profile.

This stored procedure deletes the profile regardless of whether users have access to the profile. Use caution when removing the default private profile for a user or the default public profile for the msdb database. When no default profile is available, sp_send_dbmail requires the name of a profile as an argument. Therefore, removing a default profile may cause calls to sp_send_dbmail to fail. For more information, see sp_send_dbmail (Transact-SQL).

The stored procedure sysmail_delete_profile_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 profile named AdventureWorks Administrator.

EXEC msdb.dbo.sysmail_delete_profile_sp
    @profile_name = 'AdventureWorks Administrator';

Related content