Question

I want to debug in TSQL.When I start the debug the following message box popup. In SSMS v17.2

enter image description here

Then I see this message:

enter image description here

In Microsoft Visual Studio 2015 Server Explorer same Error:

enter image description here

Then I see this message:

enter image description here

Thank You!

Was it helpful?

Solution

Debugging is a highly privileged operation. Therefore, only members of the sysadmin fixed server role are allowed to debug in SQL Server.

See How to: Enable Transact-SQL Debugging for details on the requirements.

There also several Connect items discussing this and listing some possible scenarios:

  • Debugging without sysadmin permissions

    While I understand the frustration behind lack of debugging support for non-sysadmin members, there are lot of challenges in enabling such support in the engine. We looked at in the past & didn't find a clean way to isolate the debugging experience in the server without affecting other processes. Below are some key issues:

    1. Debugging in general requires higher privileges, this is true of SQL Server or OS for that matter
    2. Debugging SQLCLR code in SQL Server for example can freeze other SQLCLR tasks in the server severely affecting performance
    3. Debugging endpoints are DCOM based today and it has its own restrictions
    4. Lastly, debugging T-SQL code in a production server is not something we recommend. The scenario is primarily for development purposes and there are alternatives which I will describe below

    You can use Visual Studio or SQL Server Management Studio or SQL Server Data Tools (SSDT)to debug against a local copy of SQL Server. In SQL Server 2012, we also have the SQL Server Express LocalDB SKU which is used by SSDT. Today, the surface area / features supported in LocalDB is a subset of SQL Server but our long-term goal is to enable all features that are supported in SQL Server including SQL Azure. So our recommendation is to use the local dev environment to debug the T-SQL logic. Additionally, you can obtain clone database (which includes statistics without data) to repro query plan related issues too. This will work for most cases other than environment specific problems or missing features in LocalDB. Hope this helps.
    Umachandar, SQL Programmability Team

  • T-SQL debugging only with sa privileges!?

  • Debugging SQL Query fails with an error

    The minimum security requirement is sysadmin. This is by design from SQL engine security.

Licensed under: CC-BY-SA with attribution
Not affiliated with dba.stackexchange
scroll top