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

前端 未结 9 2397
长情又很酷
长情又很酷 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:18

    Out of habit I place LINENO 0 directly after BEGIN in my stored procedures. This resets the line number - to zero, in this case. Then just add the line number reported by the error message to the line number in SSMS where you wrote LINENO 0 and bingo - you have the error's line number as represented in the query window.

提交回复
热议问题