The server principal is not able to access the database under the current security context in SQL Server MS 2012

后端 未结 10 918
-上瘾入骨i
-上瘾入骨i 2020-12-13 01:46

I am trying to access my hosting server’s database through SQL Server Management Studio, everything till login is fine but when I use the command use myDatabase

10条回答
  •  借酒劲吻你
    2020-12-13 02:39

    This worked for me:

    use 
    EXEC  sp_change_users_login @Action='update_one', @UserNamePattern='',@LoginName='';
    

    The problem can be visualized with:

    SELECT sid FROM sys.sysusers WHERE name = ''
    SELECT sid FROM sys.syslogins WHERE name = '';
    

提交回复
热议问题