Why does a database have to be published in order to debug?

Roz Zamboni 0 Reputation points
2023-10-31T15:58:10.2033333+00:00

To my knowledge, it is not possible to debug SQL code (function, trigger, procedure, etc) until it is deployed/published.

So, my question then, is - why?

Why am I unable to directly work on and debug source code? Why do I have to test in a database, outside of the IDE? This creates unnecessary manual steps, and thereby, room for error.

Visual Studio
Visual Studio
A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.
5,190 questions
SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
13,980 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.
1,004 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Tianyu Sun-MSFT 31,246 Reputation points Microsoft Vendor
    2023-11-01T03:33:09.2033333+00:00

    Hello @Roz Zamboni ,

    Welcome to Microsoft Q&A forum.

    As I know, you need a database to debug your SQL code, for example LocalDB. You might not be able to debug SQL code outside of a database.

    Normally, you can select whether to deploy your project or not, by checking or unchecking the "Deploy" option in "Configuration Manager" in Visual Studio, but I think "Deploy" option is not for database related projects.

    User's image

    Have a nice day.

    Sincerely,

    Tianyu


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

    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.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.