4

I created a user testUser and assigned it to newly created role executive.

I then created the following procedure:

CREATE PROC dbo.spTest
AS
BEGIN
    SELECT FirstName, LastName 
    FROM dbo.Emp
END

And granted the permission to execute that stored procedure to role:

GRANT EXECUTE ON dbo.spTest TO executive

When I try executing the stored procedure using the testUser, I get the following error message:

The SELECT permission was denied on the object 'Emp', database , schema 'dbo'

Everything I read online says that the GRANT EXECUTE line should work, but it clearly doesn't. I've also read that this error message appears if for dynamic SQL, but I'm pretty sure this is static.

I don't know why it doesn't work. Can anyone help?

edit: I don't want to give SELECT permission to the Emp table (has sensitive data).

Tab Alleman
  • 31,483
  • 7
  • 36
  • 52
Magalha
  • 41
  • 3

0 Answers0