I have a stored procedure which loads data into a target table and works fine when run in a session with my AD credentials.
When I try to run it in a job (again with my AD details in the Run As option) suddenly the login does not have access to one of the DB's.
I used
EXEC SP1
Which worked fine.
I used (to emulate running the stored procedure in a job)
EXECUTE AS user = 'Domain\JDoe'
EXECUTE SP1
REVERT
Which failed.
Why does the stored procedure fail when running with the same credentials which are used successfully in a different session window?
Thanks in advance
TRUSTWORTHY
. Note that this has other security implications. – TestimonyTRUSTWORTHY
property but the source DB is our production CRM DB and I can't get a lock – ValuerWITH ROLLBACK IMMEDIATE
to the end of the command to throw everyone else out first. – Testimony