slantyyz

685 days ago

0

votes

SQL Server: Updating Logins after a Detach or Restore

229 views

If you ever migrate a SQL Server database from one server to another, you'll find that the database IDs get messed up when you reattach the database.

Use the SQL below to migrate the database's legacy ids to the new server's ids:

USE dbname
go
EXEC sp_change_users_login 'Update_One', 'oldid', 'newid'
 

Comments

 

No answers have been submitted yet. Log In or Register to provide an answer.