SELECT SYS.DM_EXEC_REQUESTS.SESSION_ID,TEXT AS '執行SQL',CLIENT_NET_ADDRESS AS '請求IP',SYS.DM_EXEC_CONNECTIONS.CONNECTION_ID AS '連接ID',LAST_READ AS '最後讀取時間',LAST_WRITE AS '最後寫入時間',CLIENT_TCP_PORT AS '客戶端端口',CPU_TIME AS 'CPU時間',BLOCKING_SESSION_ID AS '加鎖ID' FROM SYS.DM_EXEC_REQUESTS CROSS APPLY SYS.DM_EXEC_SQL_TEXT(SQL_HANDLE) LEFT JOIN SYS.DM_TRAN_LOCKS ON SYS.DM_EXEC_REQUESTS.SESSION_ID=SYS.DM_TRAN_LOCKS.REQUEST_SESSION_ID LEFT JOIN SYS.DM_EXEC_CONNECTIONS ON SYS.DM_EXEC_CONNECTIONS.SESSION_ID=SYS.DM_EXEC_REQUESTS.SESSION_ID WHERE RESOURCE_TYPE='OBJECT' ORDER BY CPU_TIME DESC