January 16, 2009 at 6:15 pm
Thank you all for your support
M&M
July 9, 2016 at 3:01 pm
December 21, 2016 at 2:03 pm
🙂
December 21, 2016 at 2:11 pm
If sending the email with the attachment is not the first step in your job, any previous steps that interacted with that file have a 'lock' on it.
This is why it works when called as a standalone execution.
Message
Executed as user: NT AUTHORITY\SYSTEM. Failed to open attachment file 'Drive:\Path\FileName'. Executing API 'CreateFile' failed with error number 32. [SQLSTATE 42000] (Error 22051). The step failed.
After hours of trying permissions on the folder, setting the agent to run as the local service account etc etc I finally moved the email step into its own job. In the previous job, I just changed the last step to call the 'email' job:
[font="Arial Black"]EXECUTE msdb.dbo.sp_start_job 'Name of Email Job'[/font]
Worked like a charm once then failed for same error next run.
Viewing 4 posts - 16 through 18 (of 18 total)
You must be logged in to reply to this topic. Login to reply