Unable to debug Stored Procedure

D D 1 Reputation point
2021-08-30T20:02:34.027+00:00

I get the following error:

Unable to start the Transact-SQL debugger, could not connect to the Database Engine instance. Make sure you have enabled the debugging firewall exceptions and are using a login that is a member of the sysadmin fixed server role.
I'm debugging in VS2019 Community Edition

I have:

  1. Enabled Firewall rules
  2. After above did not work I disabled the firewall completely
  3. Confirmed sa account had sysadmin role
    Installed SQL server on same machine as Visual Studio to avoid any Domain security issues.
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,759 questions
Visual Studio Debugging
Visual Studio Debugging
Visual Studio: A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.Debugging: The act or process of detecting, locating, and correcting logical or syntactical errors in a program or malfunctions in hardware. In hardware contexts, the term troubleshoot is the term more frequently used, especially if the problem is major.
945 questions
Windows Server Security
Windows Server Security
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.Security: The precautions taken to guard against crime, attack, sabotage, espionage, or another threat.
1,729 questions
Transact-SQL
Transact-SQL
A Microsoft extension to the ANSI SQL language that includes procedural programming, local variables, and various support functions.
4,555 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Erland Sommarskog 101.4K Reputation points MVP
    2021-08-30T21:18:19.05+00:00

    Using the T-SQL debugger against something else than your local instance, requires quite a bit of red tape. Personally, it is soon twenty years I stopped using the debugger. I spent more time to get it working than I won in productivity.

    And since the debugger mainly works with variables, and the most interesting action goes on in tables, it is of limited use anyway.

    I used PRINT, SELECT and occasionally sp_sqltrace.


  2. Seeya Xi-MSFT 16,441 Reputation points
    2021-08-31T03:18:57.607+00:00

    Hi @D D ,

    Windows Firewall rules must be configured to enable Transact-SQL debugging.
    See:https://learn.microsoft.com/en-us/sql/ssms/scripting/configure-firewall-rules-before-running-the-tsql-debugger?view=sql-server-ver15

    Try to start it by right clicking and selecting run as administrator, which is one of Requirements for Starting the Debugger.
    BTW, this feature works with SSMS version 17.9.1 and earlier.

    Best regards,
    Seeya


    If the response is helpful, please click "Accept Answer" and upvote it, as this could help other community members looking for similar queries.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.