Cannot find the user '', because it does not exist or you do not have permission

后端 未结 5 424
执笔经年
执笔经年 2020-12-29 20:47

I am trying to add permissions to a Store procedure for a user using this query,

USE [MyDatabaseName]
GO

GRANT EXEC ON [dbo].[StoreProcedureName] TO [UserNa         


        
5条回答
  •  [愿得一人]
    2020-12-29 21:27

    You can get problems like this when a database has been restored from another server and the GUID of the user in the database is different from that of the current server.

    This will re-link orphaned users:

    USE ;
    GO
    sp_change_users_login @Action='update_one', @UserNamePattern='', 
       @LoginName='';
    GO
    

    other than this, if the user exists and you have the relevant security rights, there is no reason what you doing wouldn't work.

提交回复
热议问题