I'm trying to debug an app, and I'd like to rule out database errors before tackling the code.
I know which stored procedure is responsible to handling the data I'm looking at, but there is no logging nor any traces set up on this DB. Is there a way to recover the parameters passed to that procedure, using existing system logs?
I've looked at:
dm_exec_procedure_stats
and fn_dblog
but they don't seem to have what I need.
I'm setting up logging moving forward.
Best Answer
There is no built-in logging mechanism that runs by default out-of-the-box to capture stored procedure parameter values.
Depending on the version of SQL Server you're using, the best way to capture that detail is via Extended Events (actual execution plans and looking at parameter runtime values. Pretty expensive though, and a bear to parse out via XML).
I suppose "best" is very subjective. I don't think there is really a great, low-impact, way to get the actual parameter values for every execution of a stored proc through some SQL Server built-in mechanism. It's probably easier to log that through the client, or via logging built into the stored proc.