cannot delete user login

  • I have a problem, an user tried to enter an application and it displays an error message, saying his user doesnt have permissions to enter that DB. And the user exists as Login in SQL Server and as user in the DB, I try to check the permissions in the DB and it displays the next message "Error 15001: Object '(null)' does not exist or is not a valid object for this operation", then I tried to assign to it a role, but it displays the error 15410: user or role does not exist in this database. Then if I want to delete it it displays error 15008: User does not exist in the current database. And if I want to assign permissions to the DB from Security->logins it shows the error 21002:[SQL-DMO] User already exists.

    Can anybody help me??

  • Check to see what name is actually used in the database. Often, DOMAN\username is set as the SQL Server Login, but the database user name may just be the username of the DOMAIN\username combination

  • first, get specifics on login

    EXEC xp_logininfo  'DOMAIN/WindowsGroupName', 'all'

    then

    EXEC sp_revokelogin  'login'

  • hi

      did you try out this one

    sp_dropuser 'username'

    after executing this try to add the user again..

     

    Thank You

    Shekhar


    Thanks ,

    Shekhar

  • It could be that the user has been orphaned - happens when the database is moved to a different server.  Try this command:

    Use mydb go sp_change_users_login 'report' 

    then this on the login returned:

    Use mydb

    go

    sp_change_users_login 'update_one', 'username', 'username'

    Cath

     

  • she said an user tried to enter an application and it displays an error message. i do not know whether she need to set up the application account to login.

  • This sounds like an orphaned user.  If the database was restored from another server with the same SQL login, the user is in the database sysusers table with an SID value from the original server, which doesn't match the SID value for the login in the master..sysxlogins table where the database now resides.  In other words, it looks like the same name to you but it is completely different ('user does not exist') to SQL Server.  Until you try to add the user, where it refuses because of the original entry ('user already exists').  You can verify this with this command:

    USE <db>

    EXEC sp_change_users_login 'Report'

    You can fix it with this:

    USE <db>

    EXEC sp_change_users_login 'Update_One', '<user>', '<login>'

  • Just to add an additional note..

    I got this error when restoring a database and the old user was still in the users list (SQL Server 2000).

    I tried to drop, etc. the user, but it said that the user didn't exist!

    I tried to refresh the database content. Still errored.

    Eventually, I closed SQL Enterprise Manager and then reopened it.

    Solved! Could delete and add a new user.

    Ridiculous!

  • Tim - I created an account just to say thanks! I spent 45 mins wrestling with this error until I read your post and tried a good old fashioned close and re-open!

    Ridiculous indeed!!

  • SSCrazy, created an account just to say thank you for this. Saved me.

Viewing 10 posts - 1 through 9 (of 9 total)

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