Sql Server 2005 “Login name” is blank after restoring from backup

Warning: count(): Parameter must be an array or an object that implements Countable in /nfs/c01/h05/mnt/6385/domains/uhleeka.com/html/blog/wp-content/plugins/uhleeka-codebox/uhleeka-codebox.php on line 65

After restoring a database from a remote server backup, the “Login name” is often disassociated.

The Solution

USE [database_name];
EXEC sp_change_users_login 'Auto_Fix', 'Username';

SQL should respond with the following:

The row for user 'Username' will be fixed by updating its login link to a login
already in existence.
The number of orphaned users fixed by updating users was 1.
The number of orphaned users fixed by adding new logins and then updating users was 0.

For more info: