Return SQL Server Connections Information Using sys.dm_exec_connections

https://www.mssqltips.com/sqlservertip/5502/return-sql-server-connections-information-using-sysdmexecconnections/ 


Return last SQL command:

SELECT DEC.session_id, T.text AS 'SQLQuery'
FROM sys.dm_exec_connections AS DEC
CROSS APPLY sys.dm_exec_sql_text(DEC.most_recent_sql_handle) AS T


Comments

Popular posts from this blog

Understanding and Using SQL Server sys.dm_exec_requests