Fix Orphaned Users In SQL Server 2008

  • Hello Ladies and Gentleman,

    Apologies if this has been asked before, but a search of the forum did not bring up anything. I used to use the SP_fix_users to sort out orphaned users after a database move in SQL 2005. I am getting mixed information as to whether this still works in SQL 2008, does anyone actually know for sure?

    I have found that this is the new way..

    USE <database_name>;

    GO

    sp_change_users_login @Action='update_one', @UserNamePattern='<database_user>',

    @LoginName='<login_name>';

    GO

    ...But this only seems to cater for one user at a time, which is not practical. Is there a new up to date version of the Fix_users, or does the old one still work?

    Thank you for reading.

    Kind Regards,

    D.

  • The sp_change_users_login procedure still works in 2008. the 'update_one' parameter maps a database user to a server login. The discrepency is when you move a database to a new instance where the login names might be the same, but the associated SIDs are different.

    Test out the other parameters 'report' and 'auto_fix' and see how they work, but the procedure does indeed still work in 2008.

    edit: here's the MS link

    ______________________________________________________________________________________________
    Forum posting etiquette.[/url] Get your answers faster.

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply