|
DBCC INPUTBUFFER / OUTPUTBUFFER
Display the last statement sent from a client to a database instance.
Syntax DBCC INPUTBUFFER (session_id [, request_id ])
[WITH NO_INFOMSGS ] DBCC OUTPUTBUFFER (session_id [, request_id ])
[WITH NO_INFOMSGS ] Key: session_id - The session ID request_id - A specific request (batch) within the session. NO_INFOMSGS - Suppress all information messages (severity 0-10)
To find the request_ids for a given session id (@@spid = current session):
SELECT request_id
FROM sys.dm_exec_requests
WHERE session_id = @@spid
Example
-- Display session # 52
DBCC INPUTBUFFER (52); DBCC OUTPUTBUFFER (52);
"A lawyer who represents himself has a fool for a client." - proverb
Equivalent Oracle command:
Select from v$SESSION