sp_send_dbmail fails with attachment

痴心易碎 提交于 2019-12-04 11:34:37

Too long to comment.

Change @exclude_query_output = 0 to @exclude_query_output = 1. This will likely print a message (error message) on what is going on.

In your example, I was able to get around the error:

Failed to initialize sqlcmd library with error number -2147024809.

that I got and I expect you'll likely get by changing @query_result_header = 0 to @query_result_header = 1. I'm not sure why the lack of headers is causing it to fail, but it fixed it on my dev box.

I had the same issue but none of the solutions I found helped. Finally MSSQLTips led me into the right direction. Running profiler I got the following error message:

Could not obtain information about Windows NT group/user 'DOMAIN\user', error code 0x5

Checking the windows security event log for Audit Failures I finally found the reason why:

The specified account's password has expired.

The active directory account which SQL Server and SQL Server Agent ran with had been set up to allow password expiration. Disabling password expiration on the AD account immediately resolved the issue.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!