Orphan/Inactive SQL 2005 Users

  • /*************************************************

    * DATABASE ORPHAN USER *

    *************************************************

    * fix a user if they had access on the database *

    * then the user was dropped and added back in *

    *************************************************/

    EXEC [sp_MSforeachdb] 'print ''Updateing: [?] ''

    exec [?]..sp_change_users_login ''autousefix_fix'', ''SQLSVC'''

  • Ur code in the provided link gives me error as below.

    Please advice

    Msg 102, Level 15, State 1, Line 2

    Incorrect syntax near '-'.

  • I can't think how it would fail, try taking out the commented section and running it, don't forget to rename SQLSVC to the user you think is orphan'ed.

  • It could be because the Action is spelled wrong? You have there "autousefix_fix" and it should be "Auto_Fix" ?

    _______________________________________________________________________
    For better assistance in answering your questions, click here[/url]

Viewing 4 posts - 16 through 18 (of 18 total)

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