Sql Server Fix Users
-
02-11-2019 - |
Question
I Create a user in my database with following command :
CREATE USER Test WITHOUT LOGIN
I created a login with the Test Name.
I want to link Test user with Test Login.
When I use following command :
EXEC sp_change_users_login 'Update_One', 'Test', 'Test'
SQL Server raised bellow error :
Msg 15291, Level 16, State 1, Procedure sp_change_users_login, Line 114
Terminating this procedure. The User name 'Test' is absent or invalid.
And when I use following command :
ALTER USER Test WITH LOGIN = Test
SQL Server Raised Bellow error :
Msg 33016, Level 16, State 1, Line 2
The user cannot be remapped to a login. Remapping can only be done for users that were mapped to Windows or SQL logins.
How can I link a Test user with Test login.
My purpose of this link : I want to restore a database from a server to another server and after complete restoring, map users with existing login on the server.
thanks in advance.
No correct solution
Licensed under: CC-BY-SA with attribution
Not affiliated with dba.stackexchange