SSMS debugger out of sync with code

Nick Ryan 216 Reputation points
2022-08-24T20:44:29.67+00:00

This question has been asked before: ssms-debugger-out-of-sync-when-stepping-through-code

I have followed the recommendations there but my debugs are still out of step. I ran DROP and CREATE on my SP then stopped and restarted SSMS (2016). I then stepped into my stored procedure and the code is aligned for the top part but if I scroll down, at a certain point in the code, it is no longer aligned. I select a line for a breakpoint and when I click add, it highlights a block of code that isn't just the instruction I selected nor is it whole lines.

Are there any other tricks that may help?

SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
12,590 questions
Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,544 questions
{count} votes

1 answer

Sort by: Most helpful
  1. CathyJi-MSFT 21,066 Reputation points Microsoft Vendor
    2022-08-25T02:51:34+00:00

    Hi @Nick Ryan ,

    > stopped and restarted SSMS (2016)

    As fa as I know, last supporting debugging SSMS version is 17.9.1, suggest you using it, you can get it from here. If it is still not work, you can easily connect to SQL Server from Visual Studio and perform Debugging on Stored Procedures after connecting the server. Please refer to below blog to get detail steps.
    234743-capture.png

    How to Debug Stored Procedures in SQL Server using Visual Studio 2019


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".