exec sp_change_users_login 'report' displays the list of orphan USERS in a database but we don't have any builtin SP which displays the orphan LOGINS.
By Orphan Logins (not users), I mean the Logins that don't have any access to any databases and are sitting idle on the server (also aren't member of any fixed server role).
We can look "AUSER" field of sp_helplogins but again this procedure displays some unwanted information also and moreover, this does not take into account if the login is a member of any fixed server role.
My script usp_OrphanLogins.sql takes care of all the abovementioned concerns.
Also, this SP gives a user friendly message and quits if any of the database is not accessible. This makes sense because we may have some databse restore in progress or some database offline at times.
I'm creating the SP in tempdb database and to exec it simply run EXEC tempdb..usp_OrphanLogins.
For any queries, mail me at firstname.lastname@example.org
When doing bulk data changes it may be beneficial to disable indexes prior to starting the operation. Fortunately, SQL's rich metadata makes this very easy to automate in a robust fashion.