user7879707
user7879707

Reputation: 31

Granting a permission of a stored procedure to a user

I'm trying to allow a stored procedure for a user, but struggling to get it right. Hopefully I'm on the right track, thanks for the help.

GO 
Alter role ReportDeveloper
Add sp_GetActiveProductInfo   
GRANT EXECUTE ON ReportDeveloper TO employee_usr; 

Upvotes: 0

Views: 58

Answers (3)

Ilyes
Ilyes

Reputation: 14928

You can do it as ;

USE databse;   
GRANT EXECUTE ON sp_GetActiveProductInfo TO employee_usr;  
GO

If you add this user to a Role you will Grant the permission to the Role where your user is member in :

USE databse;   
GRANT EXECUTE ON sp_GetActiveProductInfo TO ReportDeveloper;  
GO

Upvotes: 0

Wendy
Wendy

Reputation: 660

Grant permission to database role not user.

USE DB_NAME;   
GRANT EXECUTE ON sp_GetActiveProductInfo TO ReportDeveloper;  
GO

Upvotes: 1

Rahul
Rahul

Reputation: 77876

It rather should be like below per Documentation

USE DB_NAME;   
GRANT EXECUTE ON OBJECT::sp_GetActiveProductInfo
    TO employee_usr;  
GO  

Upvotes: 0

Related Questions