删除 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
相关文章