views:

59

answers:

1

Terribly worded question above (trying to be short). Lets try that again:

In Microsoft SQL Server Management Studio, when you are editing an SP and execute the sp in the same window, errors show up at the bottom of the screen you can double click to highlight the code causing the error. However, this never lines up, usually being anywhere between 6 to 13 lines from the actual error, usually lower. It will highlight things like comments, etc.

Anyone know how to get these to line up? What constitutes a line in T-SQL?

I have tried all the normal things like putting comments in-line (no effect), removing comments before the alter procedure line (no effect), removing all code before the alter procedure line like SET ANSI_NULLS ON, etc (no effect). Odd.

+1  A: 

Line 1 for errors = the first line is sys.sql_modules which may be "ALTER PROCEDURE" but could be a blank line. it's different for batches, but the question is about stored procs.

Line 1 for VS and SSMS = 1st line in the window

So, the SET stuff above + any blank lines cause the difference.

Solution: remove everything above "ALTER PROC" so this is line 1.

gbn
I did. And it doesn't agree for some reason. The error says it is on line 77, it highlights line 90 after double clicking the error, but the actual error is on line 80. Odd.
Dr. Zim
hmmm. I assume errors at "alter" time? i can't reproduce in my SSMS 2005 SP2.
gbn