January 16, 2009 at 6:15 pm
Thank you all for your support
M&M
July 9, 2016 at 3:01 pm
Notify multiple operators with difference results
https://sqlhiker.com/2016/07/09/notify-multiple-operators-with-difference-results/%5B/url%5D
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 19 (of 19 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy