sql server - is there a way to find out which statement in TSQL stored procedure crashed? -


This article claims about SQL Server development: "Errors must be checked after every SVL statement".

The SQL Debugger's pretty unclear online description for TSQL neither rejects nor supports this claim.

So, is it really the case that is "easy to debug" stored procedure, whose 50% code is dedicated to detecting errors? Or are there any better ways to do this, which can come closer to finding the crash that we are familiar with stack trace based debugging in modern programming environments?

Is there an area that creates a clever new tool to fill the gap in spite of the incompleteness of the current programming environment, or who calls me to call together with the program and some of the famous things to achieve this Learns state-of-the-art methods?

ETA: Found on try-capture, thanks in fact, to expand on it, here's the discussion of imitating the stack trace because apparently the stack trace is not yet supported by SQL Server . Well, at least in this way the article written after the review can be simulated in its own codebase - it would be difficult to deal with a legacy codebase without all this stuff.

You can use:

  Information about the error ERROR_LINE ()   

to receive. To use it, you have to use "hold ... to deal with the error". This information is available in the "catch" block.

Documentation:

Example:

Comments