• Perry Whittle (2/1/2013)


    SQLCrazyCertified (2/1/2013)


    DECLARE fixusers CURSOR

    FOR

    SELECT UserName = name FROM sysusers

    WHERE issqluser = 1 AND (sid IS NOT NULL AND sid <> 0x0)

    This first part declares a cursor checking sql server user accounts in the specified database ensuring the SID is not null and the user is not dbo.

    SQLCrazyCertified (2/1/2013)


    AND suser_sname(sid) IS NULL

    This part compares the database user SID to the server level logins and if its null no login exists.

    Hi Perry,

    So, basically what it is doing is, it is creating the login using the SID of the user? and mapping it?......If my understanding is correct, I can understand if it's Windows authentication, but if it's SQL authentication, how does this work?....Please let me know if my understanding is correct?

    Thanks,

    SueTons.

    Regards,
    SQLisAwe5oMe.