SQL Server execute procedure as user
问题 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