2017-05-10 48 views
0

我正在嘗試爲用戶提供存儲過程,但努力讓它正確無誤。希望我在正確的軌道上,感謝您的幫助。向用戶授予存儲過程的權限

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

你只需要在最後一行 – Sami

+0

只想TOA補充一點,你應該不要使用'sp_'作爲存儲過程名稱前綴,因爲它指定了系統存儲過程:https://docs.microsoft.com/en-us/sql/t-sql/statements/create-procedure-transact-sql –

回答

0

它更應該是像每Documentation

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

授予以下權限的數據庫角色不是用戶。

USE DB_NAME; 
GRANT EXECUTE ON sp_GetActiveProductInfo TO ReportDeveloper; 
GO 
0

你可以這樣做;

USE databse; 
GRANT EXECUTE ON sp_GetActiveProductInfo TO employee_usr; 
GO 

如果這個用戶添加到Role您的用戶是成員,你會Grant權限到Role

USE databse; 
GRANT EXECUTE ON sp_GetActiveProductInfo TO ReportDeveloper; 
GO