Is there a trace configuration or setting that will enable the profiler to output ERROR_PROCEDURE()
and ERROR_LINE()
information that is always available when writing manual error handling in CATCH
blocks?
Doing a full trace of every statement being executed is very overwhelming on active systems (I got 45k entries trying it on my test system), and even then you have to guess where the error came from based on the preceding entries.
Best Answer
If you're able to use Extended Events, this is a lot easier. As you said:
You can set up the XE session like this:
A simple proc to throw an error:
Start the session and run the procedure a couple few times:
Then check your XE session:
You should get results something like this: