SQL Error 15434 results from trying to drop a login which has an active connection to an SQL Server Instance.
As part of our Server Support Services, we have provided solutions to SQL related issues for our customers.
In this context, we will look into the causes of this error and how to get it resolved.
What triggers SQL Server Error 15434?
This error is usually triggered in the process of trying to log into an SQL Server Instance or when a the login is being dropped. You will see an error message such as;
Drop failed for Login “domain\xyz”
Could not drop login ‘domain\xyz’ as the user is currently logged in. (Microsoft SQL Server, Error: 15434)
How to fix SQL Server Error 15434?
Resolving this issue translates to finding out the active sessions for the login and killing such sessions.
Now to know more about the connection session, you can run the following T-SQL query;
SELECT login_name, * FROM sys.dm_exec_sessions
WHERE login_name = ‘domain\xyz’
This will display all the information of the Login as well as its session ID.
As earlier stated, to fix this issue, you have to kill this session with its id.
To kill the session, run the query below;
Here, "active_session_id" signifies the id of the session which you are about to kill.