Debugging SQL in Visual Studio

Lance Watanabe
2 min readOct 19, 2021

--

I’m a total newbie to Microsoft SQL Server Management Studio (“SSMS”). I’m trying to debug SQL functions and getting totally lost. To make matters worse, SSMS does not have a built-in query debugger. Fortunately, you can debug your SQL queries in Visual Studio

  • Tools => SQL Server => New Query
  • Enter the Server Name = yourLocalComputer (you can find this name in your windows system settings => computer name), Authentication = SQL Server Authentication, Username = sa, Password = yourPassword, Database Name = yourDatabaseName
  • A new page will open in Visual Studio. Type several SQL queries.
  • Insert a breakpoint by clicking on the left border of the file’s frame
  • Alt + F5 to start the debugger
  • F10 to step over a line or F11 to step into the line.
  • You can check the value of variables by selecting the locals tab. As you can see below, the debugger is showing the value of @YourVariable.

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

No responses yet