Assign a login to a user created without login (SQL Server)

后端 未结 6 2036
逝去的感伤
逝去的感伤 2021-01-31 07:52

I have got a user in my database that hasn\'t got an associated login. It seems to have been created without login.

Whenever I attempt to connect to the database with t

6条回答
  •  终归单人心
    2021-01-31 08:24

    Through trial and error, it seems if the user was originally created "without login" then this query

    select * from sys.database_principals
    

    will show authentication_type = 0 (NONE).

    Apparently these users cannot be re-linked to any login (pre-existing or new, SQL or Windows) since this command:

    alter user [TempUser] with login [TempLogin]
    

    responds with the Remap Error "Msg 33016" shown in the question.

    Also these users do not show up in classic (deprecating) SP report:

    exec sp_change_users_login 'Report'
    

    If anyone knows a way around this or how to change authentication_type, please comment.

提交回复
热议问题