Debug SQL Server stored procedures like regular code. Edit locally, trace variables, step through execution.
Two Ways to Debug
Mode 1: Standalone (No .NET Project Required)
Just have a .sql file and a SQL Server connection. The extension handles everything:
- Open any
.sqlfile in VS Code - Right-click the file → "Debug Standalone" (or run command:
SpDev: Debug Standalone) - Enter your SQL Server connection string (saved for next time)
- Enter values for each
@parameterfound in the SQL - Debug starts — line highlighting, variables panel, step over/continue
No .NET project, no NuGet package, no configuration needed.
Mode 2: Integrated (With .NET Project)
For debugging stored procedures called from your .NET application:
-
Install the NuGet package:
dotnet add package SpDev.Runtime -
Configure in
Program.cs:builder.Services.AddSpDev(options => { options.Enabled = builder.Environment.IsDevelopment(); options.ProcedureDirectory = "./Procedures"; }); -
Create a
Proceduresfolder with your.sqlfiles -
When your app calls
EXEC MyProcor uses Dapper withCommandType.StoredProcedure, the local.sqlfile executes instead with full tracing
Features
- Standalone Debug: Debug any
.sqlfile without a .NET project — just provide a connection string - Local File Execution: Edit stored procedures as
.sqlfiles in your project - Dapper Support: Works with EF Core, Dapper, and raw ADO.NET
- Variable Tracing: See variable values at each statement
- Step-Through Debugging: F10 to step, F5 to continue
- Zero Production Impact: Disabled by default, no overhead when off
- Sync Status: See which procedures have drifted from database
Requirements
- .NET 8 SDK (for standalone mode)
- SQL Server 2019+ or Azure SQL Database
- For integrated mode: SpDev.Runtime NuGet package
Extension Settings
This extension contributes the following settings:
spdev.connections: Array of saved connection strings for quick accessspdev.traceServerPort: Port for trace server (default: 52341)
Known Issues
See GitHub Issues
Release Notes
0.1.2
- Standalone debug mode: Debug any
.sqlfile without a .NET project - Dapper support:
CommandType.StoredProcedurenow intercepted - Connection string saving for quick reuse
- Parameter auto-detection from SQL files
0.1.0
Initial release with:
- EXEC statement interception
- Variable tracing
- Step-through debugging
- Sync status tree view