我正在尝试发送Sproc结果的电子邮件。我曾试着这样做:将Sproc结果发送到SQL Server中的电子邮件
EXEC msdb.dbo.sp_send_dbmail
@recipients = '[email protected]',
@query = 'EXEC test_email' ,
@subject = 'Sample Data',
@attach_query_result_as_file = 1 ;
它给了我下面的错误:
Msg 15281, Level 16, State 1, Procedure sp_send_dbmail, Line 0
SQL Server blocked access to procedure 'dbo.sp_send_dbmail' of component 'Database Mail XPs' because this component is turned off as part of the security configuration for this server. A system administrator can enable the use of 'Database Mail XPs' by using sp_configure. For more information about enabling 'Database Mail XPs', see "Surface Area Configuration" in SQL Server Books Online.
是否有任何其他方式做到这一点?
我觉得这里的错误信息实际上很有帮助。您是否尝试与您的DBA检查以启用所需的SQL Server组件来发送电子邮件? – dcp