A Windows desktop tool for executing a SQL script across multiple databases on a SQL Server instance. Built for DBAs and backend engineers who need to run the same script — schema changes, data fixes, maintenance routines — against many databases without the repetition of doing it manually in SSMS.
- Save multiple SQL Server connections with friendly names
- Windows Authentication and SQL Server Authentication
- Test connections before saving
- Connections persisted to
%APPDATA%/SQLScriptRunner/connections.json - SQL auth passwords encrypted with Windows DPAPI (current-user scope)
- Auto-discovers databases from
sys.databaseson connect - Offline databases shown but not selectable
- Quick filter to search databases by name
- Select All / Deselect All buttons
- Save named subsets of databases per connection (e.g. "Production", "Staging")
- Create, edit, delete, and apply saved lists
- Quick-save current selection as a new list
- Built-in script editor with monospace font
- Load
.sqlfiles from disk GObatch separator support (SSMS-compatible)- Sequential execution across selected databases
- Progress bar with percentage tracking
- Cancel between databases (current database completes, remaining are marked cancelled)
- Confirmation prompt before execution
- Per-database results: status icon, elapsed time, rows affected, error details
- Export log to file
- Copy log to clipboard
- Clear log
| Shortcut | Action |
|---|---|
Ctrl+O |
Load script file |
Ctrl+E |
Execute script |
- Windows 10 or later
- .NET 10.0 Desktop Runtime
- Network access to target SQL Server instances
git clone https://github.com/<your-username>/SQLScriptRunner.git
cd SQLScriptRunner/src/SQLScriptRunner
dotnet build
dotnet rundotnet publish -c Release -r win-x64 --self-contained- Add a connection — Click
+in the Connections panel, enter server details, and test the connection. - Connect — Select a connection and click Connect to load its databases.
- Select databases — Check the databases to target, or apply a saved database list.
- Write or load a script — Type SQL in the editor or click Load Script to open a
.sqlfile. - Execute — Click Execute. Confirm the prompt. Monitor progress and results in the log.
- Review — Export or copy the execution log for your records.
src/SQLScriptRunner/
├── Models/ # Data models (ServerConnection, DatabaseInfo, etc.)
├── ViewModels/ # MainViewModel (MVVM with CommunityToolkit.Mvvm)
├── Views/ # (reserved)
├── Dialogs/ # Edit Connection, Edit Database List dialogs
├── Services/ # SQL connection, script parsing, connection storage
├── Converters/ # WPF value converters
├── Assets/ # Application icon
├── MainWindow.xaml # Main UI layout
└── App.xaml # Application entry point
| Package | Version | Purpose |
|---|---|---|
| CommunityToolkit.Mvvm | 8.4.0 | MVVM framework (observable properties, commands) |
| Microsoft.Data.SqlClient | 6.1.4 | SQL Server connectivity |
| System.Security.Cryptography.ProtectedData | 10.0.5 | DPAPI password encryption |
- SQL auth passwords are encrypted at rest using Windows DPAPI (
DataProtectionScope.CurrentUser). They are tied to the current Windows user profile and cannot be decrypted by other users or on other machines. - Connection data is stored locally in
%APPDATA%/SQLScriptRunner/. No data is transmitted externally. TrustServerCertificateis enabled by default for local/dev server connections.
GObatch splitting is text-based — aGOon its own line inside a block comment or string literal will still cause a split.GO <count>(e.g.GO 10) is not supported.- Cancellation is inter-database: once a database starts executing, it runs to completion.
- No stop-on-first-error option — execution continues to the next database after an error.
This project is licensed under the MIT License.