Debugging Stored Procedures shows wrong line pointers

Hello all,

I have an extremely annoying problem when debugging stored procedures in SQL Server 2014 with SSDT or SSMS. When calling a SP thru EXECUTE in Debug mode, 9 out of 10 SPs are traced with a wrong yellow arrow-pointer to the line currently reached. The offset is between 6 to 15 lines downward. Tracing itself and update of the "Locals"-view works as expected. All SPs contain comments also before the Create Procedure statement. The SP shown when tracing show exactly the same content as the stored SQL in the SSDT project under work incl. Create procedure and all comments.

The picture here show the first line selected after the debugger has traced into the SP. The first line really executed with "Next" will be SET NOCOUNT ON.

Any idea to get rid of this annoying behavior? If this does not turns out as my fault and some of you would support that, I would like to post this to SQL Connect.

April 26th, 2015 11:56am

Hi Jrg,

Based on your description, when calling a stored procedure through EXECUTE in Debug mode , the yellow pointer will stop on the " SET NOCOUNT ON, right? I make a test on my computer, and I get the same result as your scenario. This debug behavior is by design in SQL Server, as far as I know, there is no method to get rid it.

If you concern about the debug behavior in SQL Server Management Studio , you can submit a feedback to the Microsoft Connect at this link https://connect.microsoft.com/SQLServer/Feedback  . Your feedback enables Microsoft to offer the best software and deliver superior services.

Thanks,
Lydia Zhang

If you have any feedback on our support, please click here.

Free Windows Admin Tool Kit Click here and download it now
April 26th, 2015 11:39pm

Hi Jrg,

Based on your description, when calling a stored procedure through EXECUTE in Debug mode , the yellow pointer will not stop on the " SET NOCOUNT ON, but stop on the line as your screenshot, right? If so, I make a test on my computer, however I cannot reproduce your scenario. 

As far as I know, there is no method to get rid the debug behavior. If you concern about the debug behavior in SQL Server Management Studio , personally, I recommend you submit a feedback to the Microsoft Connect at this link https://connect.microsoft.com/SQLServer/Feedback  . Your feedback enables Microsoft to offer the best software and deliver superior services.

Thanks,
Lydia Zhang

If you have any feedback on our support, please click here.

April 27th, 2015 3:38am

Based on your description, when calling a stored procedure through EXECUTE in Debug mode , the yellow pointer will stop on the " SET NOCOUNT ON?, right?

As I read Jörg's post and screenshot, the pointer is showing one line, when execution is in fact on another.

I did not try to repro this myself, as it was long ago I gave up using the debugger. I found that spent more time to get it working than I gained from it. PRINT and SELECT works well for me.

Free Windows Admin Tool Kit Click here and download it now
April 27th, 2015 5:47pm

Based on your description, when calling a stored procedure through EXECUTE in Debug mode , the yellow pointer will stop on the " SET NOCOUNT ON?, right?

As I read Jrg's post and screenshot, the pointer is showing one line, when execution is in fact on another.

I did not try to repro this myself, as it was long ago I gave up using the debugger. I found that spent more time to get it working than I gained from it. PRINT and SELECT works well for me.

April 27th, 2015 9:37pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics