This repository contains a minimal Windows desktop application for executing parameterized SQL scripts with sqlcmd
.
The application allows you to:
- Browse for a
.sql
file. - Automatically detect SQLCMD variables in the script that are not defined by
:setvar
commands, and prompt for their values. - Enter SQL Server connection information.
- Execute the script via the
sqlcmd
command-line tool and display the output.
The source is implemented as a WPF project targeting .NET 6.0.
Use the .NET SDK on Windows:
dotnet build SqlcmdGuiApp/SqlcmdGuiApp.csproj
After building, run the produced executable or start it with dotnet run
:
dotnet run --project SqlcmdGuiApp/SqlcmdGuiApp.csproj
You need the sqlcmd
utility available in your PATH for the execution step to work.
The application invokes sqlcmd
with the -b
option so that any errors result
in a non-zero exit code.
Any unhandled errors encountered by the application are written to error.log
in the application directory.