Home Forums SQL Server 2005 Administering How to sync users and logins in SQL2005 after restore RE: How to sync users and logins in SQL2005 after restore

  • Shamshad Ali thanks for your reply,

    SELECT @UserName = NAME FROM sysusers WHERE issqluser = 1 and (sid is not null and sid 0x01) and suser_sname(sid) is NOT null ORDER BY name

    Should be:

    SELECT NAME FROM sysusers WHERE issqluser = 1 and (sid is not null and sid 0x01) and suser_sname(sid) is NOT null ORDER BY name

    In a cursor declaration a variable in the select statement is not allowed.

    But in the end, this does not help. Still only the SQL logins are synced and not the Windows logins with the users in the database...

    Edit: my problem is solved, but the question remains...

    The database was the Microsoft CRM 3.0 database, and I solved it now, by

    scripting the schema's and users, changed the scripts so, that the users

    where connected tot the appropiate login's, deleted the schema's and users

    and finaly recreated the users and schema's.

    There should however be an easier way, because when there are objects owned

    by schema's you are not able to delete the schema's.

    So if anyone knows the answer, please respond.