Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SQL Script Runner

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.

.NET 10 WPF License

Features

Connection Management

  • 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)

Database Selection

  • Auto-discovers databases from sys.databases on connect
  • Offline databases shown but not selectable
  • Quick filter to search databases by name
  • Select All / Deselect All buttons

Saved Database Lists

  • 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

Script Execution

  • Built-in script editor with monospace font
  • Load .sql files from disk
  • GO batch 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

Execution Log

  • Per-database results: status icon, elapsed time, rows affected, error details
  • Export log to file
  • Copy log to clipboard
  • Clear log

Keyboard Shortcuts

Shortcut Action
Ctrl+O Load script file
Ctrl+E Execute script

Requirements

Getting Started

Build from source

git clone https://github.com/<your-username>/SQLScriptRunner.git
cd SQLScriptRunner/src/SQLScriptRunner
dotnet build
dotnet run

Publish a self-contained executable

dotnet publish -c Release -r win-x64 --self-contained

Usage

  1. Add a connection — Click + in the Connections panel, enter server details, and test the connection.
  2. Connect — Select a connection and click Connect to load its databases.
  3. Select databases — Check the databases to target, or apply a saved database list.
  4. Write or load a script — Type SQL in the editor or click Load Script to open a .sql file.
  5. Execute — Click Execute. Confirm the prompt. Monitor progress and results in the log.
  6. Review — Export or copy the execution log for your records.

Architecture

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

Dependencies

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

Security

  • 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.
  • TrustServerCertificate is enabled by default for local/dev server connections.

Known Limitations

  • GO batch splitting is text-based — a GO on 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.

License

This project is licensed under the MIT License.

About

A simple tool to allow running SQL scripts across multiple AzureSQL databases on a single server

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages