I'm using extended events to trace the statements used by our application. I have created a session that will collect the information that I want, except that I would also like to know the actual values of the parameters that was used.
I am performing this trace on a non-production environment and any performance hit by the trace is acceptable.
All the queries originate from Hibernate and have been parameterized in the form of:
SELECT a, b, c From Customer where CustomerId = @P0
This is my session setup.
CREATE EVENT SESSION [TracingForStatements] ON SERVER
ADD EVENT sqlserver.sp_statement_completed (
ADD TARGET package0.ring_buffer(SET max_memory= 128000)
WITH (EVENT_RETENTION_MODE = NO_EVENT_LOSS,
MAX_DISPATCH_LATENCY = 1 SECONDS)
How can I capture the actual values of the parameters that was used in the captured statements? Is it possible?
-- Edit (Workaround): Changing the event to rpc_completed gives me the complete sql command(including all parameter values) called from Hibernate. For other cases it would still be good to know how to capture the parameter values, if it is possible.