我具有具有管理员访问权限的sql登录并正确设置了电子邮件配置文件,以下查询工作正常,并且电子邮件已交付。
EXEC msdb.dbo.sp_send_dbmail
@profile_name = 'PMADev',
@recipients = 'hboyapalli@ezesoft.com',
@body = 'youve sent email from database.',
@subject = 'great job',
@from_address = 'hboyapalli@ezesoft.com'
但是当我尝试发送带有查询结果的电子邮件作为附件时,出现以下错误-无法初始化错误编号为-2147467259的sqlcmd库。
EXEC msdb.dbo.sp_send_dbmail
@profile_name = 'PMADev',
@recipients = 'hboyapalli@ezesoft.com',
@query = N'SELECT * FROM LicenseNewSite.dbo.sugar' ,
@subject = 'Licenses expiring this week',
@attach_query_result_as_file = 0 ,
@query_result_header = 1,
@exclude_query_output = 0,
@execute_query_database = 'LicenseNewSite';
请在这里帮助我。