first_page the funky knowledge base
personal notes from way, _way_ back and maybe today

SQL Server 2005 t-SQL: Linking an Orphaned Database User to a Server Login

/* A user gets often gets orphaned (or broken) when attaching a database to a new server.

Documentation:
    http://msdn2.microsoft.com/en-us/library/ms174378.aspx

*/ EXECUTE sp_change_users_login @Action='Auto_Fix', @UserNamePattern='my_orphaned_user', @Password='myS3curePassw0rd'

-- This command is available in SQL Server 2000.

mod date: 2007-09-17T20:16:37.000Z