When a client connection with the SQL Server (from client side) is cut, how can I detecting this disconnection in SQL Server (2008 or 2012)?
Can I solve this problem with Server Triggers?
You can create an event notification for the Audit Logout event. The notification can launch an activated procedure. Consider though that event notifications are asynchronous.
You could query one of the sys
tables (sysprocesses
)
SELECT
DB_NAME(dbid) AS Database,
loginame AS LoginName
FROM sys.sysprocesses
You can also run the following stored procedure to see who is active:
sp_who2
You would have to have a SQL Job or an active agent checking to see who has dropped out.