Orphaned Users

  • Does anyone know of a script that would loop through the resultset of the sp_change_users_login 'Report' and for each login run the sp_change_users_login 'Update_One', <name>, <name>, where the name would be populated by the report.

    I have many users that need to be straightened out after a restore. Any simple way or am I stuck doing them one by one.

    Any help would be appreciated.

    Thanks

    Brian


    BK

  • We may have a script here on the site, not sure. You could use a cursor to build it if not. Faster is to bypass the proc altogether and do it yourself - all it's doing is updating the sid in sysusers based on a join to master..sysxlogins. One update should do it. Have to have sa rights and allow table updates.

    Andy

    http://www.sqlservercentral.com/columnists/awarren/

  • Thanks Andy. I will give it a try.

    Brian

    Brian Kramer


    BK

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

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