Hi @pmscorca ,
Thankyou for using Microsoft Q&A platform and thanks for posting your query here.
I understand that while trying to drop Login , you are facing this error: "Could not drop login 'xxxx@yyyy.com' as the user is currently logged in".
Kindly try to Terminate All Sessions for the Login before dropping the login.
- First, you need to terminate any active sessions for the login you wish to drop. You can use the following SQL command to kill all sessions for that login:
-- Replace 'xxxx@yyyy.com' with your actual login name
DECLARE @kill varchar(max) = '';
SELECT @kill = @kill + 'KILL ' + CONVERT(varchar(5), session_id) + ';'
FROM sys.dm_exec_sessions
WHERE login_name = 'xxxx@yyyy.com';
EXEC(@kill);
- Post that, drop the login:
DROP LOGIN [xxxx@yyyy.com];
Hope it helps. Kindly accept the answer by clicking onAccept answer
button. Thankyou