DMV를 사용하여 sp_who2 + DBCC Inputbuffer(spid) 작업을 한번에 하기
SELECT A.session_id, B.text FROM sys.dm_exec_connections A CROSS APPLY sys.dm_exec_sql_text(most_recent_sql_handle) B SELECT ISNULL(D.text, '') AS SQLStatement, A.Session_ID SPID, ISNULL(B.status,A.status) AS [Status], A.login_name AS [Login], ISNULL(A.host_name, ' .') AS HostName, ISNULL(CAST(C.BlkBy AS varchar(10)), ' .') AS BlkBy, DB_NAME(B.Database_ID) AS DBName, B.command, ISNULL(B.cpu_time..