Sorry if this is a repeat question but I dont know what I am doing wrong here. I have created a Stored Proc which when you pass in a parameter of SQL Login, it then passes through every database on the server and returns all the perms for that SQL Login
on every database. This is a request from one of our Managers you wants to be able to see a users database perms at any point in time by just running the proc. As he is not 'sa' himself, my idea was to create a proc the set it to EXECUTE as SA. So that whenever
he ran it he would get the info he needs.
So my proc works fine when I run it as I am 'sa'. I now need to add the "Execute as SA" command but it wont let me as follows
CREATE PROCEDURE dbo.usp_CheckUserPermsAll
-- Add the parameters for the stored procedure here
WITH EXECUTE AS 'sa'
-- SET NOCOUNT ON added to prevent extra result sets from
View Complete Post