Transact-SQL 参考

xp_deletemail

删除 Microsoft® SQL Server™ 收件箱中的邮件。sp_processmail 使用 xp_deletemail 处理 SQL Server 收件箱中的邮件。

语法

xp_deletemail {'message_number'}

参数

'message_number'

是收件箱中应删除的邮件的编号(由 xp_findnextmsg 赋值)。message_number 的数据类型为 varchar(255),无默认值。

返回代码值

0(成功)或 1(失败)

结果集

当所传递的邮件ID 有效时,xp_deletemail 返回下列结果集。

The command(s) completed successfully.
注释

除无效参数外的任何失败均记入 Microsoft Windows NT® 应用程序日志。

权限

xp_deletemail 的执行权限默认授予 sysadmin 固定服务器角色的成员,但可以授予其他用户。

示例

下例删除 xp_findnextmsg 提供的邮件ID 所对应的邮件。xp_findnextmsg 的值将置于局部变量 @message_id 中。

DECLARE @message_id varchar(255)
SET @message_id = 'XA17' -- Setting to a value would go here.
USE master
EXEC xp_deletemail @message_id

请参见

sp_processmail

系统存储过程(SQL 邮件扩展过程)

xp_findnextmsg

xp_readmail

xp_sendmail

xp_startmail

xp_stopmail