We have a database backup we need to restore on a server that doesn't have the logins for the database… all the users are in the database though so we are hoping we can restore it this way?
I've played with sp_change_users_login but it only works with creating new users or linking orphaned database users to existing server users (mis-matched SID's but same usernames).
I need to create server logins from the user info stored in a database.
Best Answer
If your goal here is to recreate the the logins with the same password then you are SOL, this is only stored in the tables/views in the master database. Brian's recommendation will work if the old instance is still around but if not then you will need to do one of the options below.
or
Note that this is only the case with SQL logins, if you are using Active Directory logins then all you need to do is add them back to the server and they will automatically have rights in the restored databases because the password and SID are stored in AD and not in the master database for the instance.