I am executing a stored proc from SSMS and I get this error message:
Msg 295, Level 16, State 3, Procedure spEdiCreateOrders, Line 80 [Batch Start Line 2]
Co
About Line n
N
it is refer to the number of line of object considering any spaces with in it , or before its body.
Example 1
Assume the next is SQLQuery window after clicking New Query button in SSMS
1. Create proc spTest1
2. As
3. Begin
4. Select 1/0
5. End
after executing spTest1
, you will get the next message
Msg 8134, Level 16, State 1, Procedure spTest1, Line 4
Example 2
Assume the next is SQLQuery window after clicking New Query button in SSMS
1.
2.
3.
4.
5.
6. Create proc spTest2
7. As
8. Begin
9. Select 1/0
10. End
after executing spTest2
, you will get the next message
Msg 8134, Level 16, State 1, Procedure spTest2, Line 9
Conclusion how get the accurate number
For getting the accurate number use the system stored procedure sp_helptext
as next
Exec sp_helptext spName