How can I get the actual stored procedure line number from an error message?

前端 未结 9 2407
长情又很酷
长情又很酷 2020-12-04 07:02

When I use SQL Server and there\'s an error, the error message gives a line number that has no correlation to the line numbers in the stored procedure. I assume that the dif

9条回答
  •  无人及你
    2020-12-04 07:25

    In TSQL / Stored Procedures

    You may get an error such as:

    Msg 206, Level 16, State 2, Procedure myproc, Line 177 [Batch Start Line 7]

    This means that the error is on line 177 in the batch. Not 177 in the SQL. You should see what line number your batch starts on, in my case [7], and then you add that value to the line number to find what statement is wrong

提交回复
热议问题