How to transfer the logins and the passwords between instances of SQL Server 2005 and SQL Server 2008?

After you move a database from the instance of one SQL Server to another one, the users may not be able to log in to the database on new servers. Typically users receive the following error message:

Login failed for user '[User Name]'. (Microsoft SQL Server, Error: 18456)

This is because the server level logins were not transferred to the new instance. Please follow the instructions provided at for the best resolution of this situation.

However you may have to refer to to sync the logins between the database and server to resolve all the related issues after your migration. (This will be needed when new servers already have the login you are trying to transfer using sp_help_revlogin with a different SID. In that case, new server’s login’s SID and recently migrated databases user’s SID will not match. This recommended procedure will resolve this particular situation)

Best Practice: I will recommend to run the procedures mentioned at after the folllowing the procedures of (Unless new server is a brand new one which does not have any login). Running procedures from will not harm anything but make sure that all the logins of the database and server are properly synced.