Debugging SQL in Visual Studio
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.
