I am moving a SQL Server 2005 database to a new server using a backup. I was able to restore the backup to a new location without mishap.
The problem is, I have a number of Sql Server users who were connected to a login on the old server. Those logins were not there on the new server — so I added them in (with the same passwords).
However, the SQL Server users are not automatically updated to those logins. In fact, in ManagementStudio, when I look at the properties of a user, it says the username is “without login”, and the radio buttons are grayed out so I can’t choose another one.
I tried this:
USE GlobalData --(the name of the database)
GO
ALTER USER Centration WITH LOGIN = Centration; --(both user and login are Centration)
and I get an error:
Msg 102, Level 15, State 1, Line 1
Incorrect syntax near 'LOGIN'.
How can I do this?
You can try this:
In management studio, select your database and then execute this command:
This will produce a list of Users and Logins that are not mapped, then you can run the following command multiple times to map them; Run it per result that came back on the previous query:
etc etc.
Hope this helps.