locked
logout RRS feed

  • Question

  • Dear fiends,

    I created new user in SQL Server 2008

    Exec sp_addlogin 'jreed', 'password' 
    
    CREATE USER [John Reed] foR login [jreed] with DEFAULT_SCHEMA=[DBO]
    and I made connection  jreed to Database Engine and next I made his disconnection.
    But when I want to delete this user with using of:
    DROP USER [jreed] --It is realized
    exec sp_droplogin 'jreed'
    --message:Could not drop login 'jreed' as the user is currently logged in.
    How can I make logout this user correctly?
    Thanks a lot for your help.
     Anna




    Msg 15434, Level 16, State 1, Line 1

    Could not drop login 'jreed' as the user is currently logged in.

    Thursday, November 27, 2014 12:10 PM

Answers

  • Try below, this may help you

    may be if you try to connect in object explorer and forget to disconnect

    -- if you find any seesion for jreed
    SELECT session_id
     FROM sys.dm_exec_sessions
     WHERE login_name = 'jreed'
     -- to view the query in the session
     DBCC inputbuffer(<session id>)
     -- if you confirm it can be kill
     Kill <session id>
     
     
     exec sp_droplogin 'jreed'

    Thanks

    Sarvana Kumar C

    Thursday, November 27, 2014 1:18 PM
  • try this : 

    http://technet.microsoft.com/en-us/library/aa905194(v=sql.80).aspx

    http://blog.sqlauthority.com/2012/02/21/sql-server-force-removing-user-from-database-fix-error-could-not-drop-login-test-as-the-user-is-currently-logged-in/


    Thursday, November 27, 2014 2:23 PM

All replies

  • Did you tried closing SSMS window and logging again and then executing the Drop query.

    Please mark this reply as answer if it solved your issue or vote as helpful if it helped so that other forum members can benefit from it

    My Technet Wiki Article

    MVP

    Thursday, November 27, 2014 12:19 PM
  • Try below, this may help you

    may be if you try to connect in object explorer and forget to disconnect

    -- if you find any seesion for jreed
    SELECT session_id
     FROM sys.dm_exec_sessions
     WHERE login_name = 'jreed'
     -- to view the query in the session
     DBCC inputbuffer(<session id>)
     -- if you confirm it can be kill
     Kill <session id>
     
     
     exec sp_droplogin 'jreed'

    Thanks

    Sarvana Kumar C

    Thursday, November 27, 2014 1:18 PM
  • try this : 

    http://technet.microsoft.com/en-us/library/aa905194(v=sql.80).aspx

    http://blog.sqlauthority.com/2012/02/21/sql-server-force-removing-user-from-database-fix-error-could-not-drop-login-test-as-the-user-is-currently-logged-in/


    Thursday, November 27, 2014 2:23 PM