Cannot delete a SQL Server login

  • I've got the following error when I try to delete a login using MS SQL Server Management Studio:

    Drop failed for Login 'test'. (Microsoft.SqlServer.Smo)

    Additional information:

    Cannot drop the user 'test', because it does not exist or you do not have permission.

    I've checked there's no session with this login, no SQL jobs or objects are owned by this login. Can anyone help with this? Thanks.

  • Where is the login located, within the database or within SQL Server? I've seen where a user has permissions on one server, the database is backed up and moved to another server, and that login still exists with rights for the database, even though they don't actually exist on that server.

    Second question: which user are you logged in under when trying to delete the test user?

    --------
    For SQL Tips, check out my blog: http://lantztechknowledge.blogspot.com/[/url]
    You can also follow my twitter account to get daily updates: @BLantz2455

  • THe login is within SQL Server, I logged in under a user which belongs to sysadam fixed server role, I expect I can remove any login if I belong to sysadmin role.

  • Does the test user have any securables? If so, those need to be removed first before the user can be removed.

    --------
    For SQL Tips, check out my blog: http://lantztechknowledge.blogspot.com/[/url]
    You can also follow my twitter account to get daily updates: @BLantz2455

  • do you mean if the test login owns any objects? I used the following query to check if the login 'test' owns any object, the result is it doesn't own any objects.

    SELECT

    so.name AS 'ObjectName'

    ,su.name AS 'OwnerName'

    FROM sysobjects so

    JOIN

    sysusers su

    ON so.uid = su.uid

    WHERE xtype <> 's'

    ORDER BY 2

  • Try this--

    ALTER DATABASE [DATABASE_NAME]

    SET SINGLE_USER

    WITH ROLLBACK IMMEDIATE

    DROP LOGIN [Test2]

    _______________________________________________________________
    To get quick answer follow this link:
    http://www.sqlservercentral.com/articles/Best+Practices/61537/

  • Hi eddy,

    Please Use sp_msloginmappings and check test user detail and then delete from that database.

    or post details for test user.

  • With the Login 'test', DBName=null, UserName=null, AliasName=null

    One more question, is the deletion of the sql server login managed by Windows Domain security as well? is it possible the delete permission is disabled by Windows Domain Security? Thanks.

  • hi eddy,

    i don't think that Windows Domain security restrict to drop sql server user.

    Its a dumb thought but can u please refresh server and see that user is exist or not.

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

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