2013/05/07

KB-The EXECUTE permission was denied on the object usp_Michael, database dbMichael, schema 'dbo'

若帳號只屬於 db_reader,不是屬於 db_owner 角色時,語法中含有 store procedure or function 時,會出現此類錯誤訊息

The EXECUTE permission was denied on the object ????, database ????, schema 'dbo'

 

解決方式:

1.建立角色

CREATE ROLE [myRole] AUTHORIZATION [dbo]

2.設定執行預存程序或函式權限給與角色

GRANT EXEC ON dbo.usp_Michael TO myRole

 

3.將登入帳號加入角色

EXEC sp_addrolemember N'myRole', N'login_user'

沒有留言: