SQL Login and DB User question

  • I restored a development DB from a production backup.  I am only interested in creating 1 LOGIN (SQL Server Login) being setup as a USER in this DB.  

    When I attempt to CREATE this LOGIN (under E/M Security) and specify the default DB as the newly restored DB, I receive the error:  "User or Role already exists in the current database"

    I know how to do a Transfer Logins but I only need this 1 SQL Server user account setup. 

    How do I DELETE the User or Role from this DB when I don't see the User under USERS of ROLES in the DB?  (I do see the SQL Login under Security/Logins)

     

    BT
  • Run "select * from sysusers" in the database and locate the entry for this user. If found delete it from sysusers.

    Anurag

  • u can do as anurag said but are u deleting sa user if so then u cannot delete that user.

    if else then u can delete it from login window.

     

    from

    killer

  • It sounds like you have an orphaned user. Look up orpaned user in the BOL and they describe how to solve this issue.

    -SQLBill

  • Thanks for the responses.  Your replies helped me perform the following:

    On Ent Mgr, I select PROPERTIES for the registered server name, then I selected the SERVER Properties tab and Checked the "allow direct system table updates" box

    I then queried the Application DB system table SysUser (as you suggested) and deleted the USER.  I also deleted the Login to ensure bogus SID's were removed - and finally re-added both the Login then User.

     

    BT

Viewing 5 posts - 1 through 4 (of 4 total)

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