Interface & Features — Script Runner
Walk through the main screens, tabs, and controls you will use day to day.
Server Group Management
Creating Groups
Groups are organizational containers. Create groups like "Production Servers", "Staging", "Azure SQL", or "DR Cluster". All group and server changes are saved automatically.
Adding Servers
| Field | Description |
|---|---|
| Server Name | Full server/instance name (e.g., SQLPROD01, myserver.database.windows.net) |
| Display Name | Optional short label for long Azure MI names. Full name shown as tooltip. |
| Authentication | Choose from four modes (see below) |
| Login / Password | Required for SQL and Entra ID auth modes |
Click Test Connection to verify connectivity before saving.
Selection Controls
- Checkboxes on groups, servers, and individual databases control which targets are included in execution.
- Nothing is checked by default — you must explicitly select targets before running.
- Parent gating: a server checkbox is enabled only when its group is checked; a database checkbox is enabled only when its server is checked. This prevents accidentally targeting children under an unchecked parent.
- Checking a group cascades to its servers (and loaded databases, respecting Include DBs scope).
- Use All / None in the Server Groups header to check or clear the entire tree quickly.
Include Databases (Scope)
The Include DBs dropdown above the tree controls which databases are auto-checked when a server (or group) is selected. It does not select servers by itself.
| Scope | Auto-checks |
|---|---|
| User databases (default) | Only user databases (excludes master, model, msdb, tempdb) |
| All databases | Every online database on the server |
| System databases | Only system databases |
| master only | Only the master database |
The ⚙ button opens Include / Exclude name lists (comma- or semicolon-separated). Include names are always selected even if the scope would hide them; exclude names are always deselected.
master if enumeration fails).SQL Templates
Save and reuse common scripts the way SSMS Template Explorer works — without leaving Script Runner.
- Click Templates (next to + in the session tab strip) to open a right-side slide-out panel.
- Templates are organized into parent groups (for example Security, Maintenance, General). Create, rename, or delete groups from the panel.
- Click a template to open it in a new session with the SQL loaded.
- Use Save Template on the editor toolbar (or when creating from the panel) to save the current script. Choose a name, optional description, and parent group.
- Edit or delete templates from the panel.
Templates are stored locally in %LOCALAPPDATA%\DBLenseScriptRunner\templates.json.
Script Editor
Type or paste SQL directly into the built-in editor with:
- Syntax highlighting (keywords, strings, comments, numbers)
- Configurable font size (10–20pt via Settings)
- Execute selected text only (highlight a portion and click Execute)
- Format — uppercases keywords, places SELECT/FROM/WHERE/JOIN on new lines
- Validate — compile-checks the script without executing (
SET NOEXEC ON) - Save Template — store the current script for reuse
Script Folder Execution
Run multiple .sql files from a folder in a single batch:
- Switch to the Script Folder tab
- Click Browse... and select a folder
- All
.sqlfiles are listed with checkboxes, filename, size, and routing info - Use Select All / Deselect All to toggle; reorder with ▲/▼ buttons
- Click Execute or Validate
Scripts execute in the order shown (alphabetical by default, reorderable). Results are grouped per-script in separate tabs.
Pattern Match Routing
Use Run All (default) to send every selected script to every selected target, or switch to Pattern Match to route scripts to specific servers/databases.
Filename routing
Format (default separator --):
scriptname@server--database.sql
| Example Filename | Routing |
|---|---|
report@PROD01--Northwind.sql | Runs only on PROD01 / Northwind |
cleanup@PROD01.sql | Runs on PROD01, all databases |
index_rebuild@--SalesDB.sql | Runs on all servers, SalesDB only |
report.sql | In Pattern Match mode, skipped (no routing) |
Server matching supports exact Server Name, exact Display Name, or prefix match (for example kedprod23 matches kedprod23....database.windows.net).
Change the server/database separator in Routing Settings (⚙). Allowed examples: --, _, ~, ## (must be a valid Windows filename character sequence).
Comment directive
Optionally enable Use -- @target: comment directive so a directive in the first 10 lines of the script overrides filename routing:
-- @target: PROD01/Northwind
-- @target: kedprod23.abc.database.windows.net/SalesDB
-- @target: PROD01/* (all databases on PROD01)
-- @target: */master (master on all servers)
Script Validation (SET NOEXEC ON)
Click Validate to compile-check scripts without executing them. This catches:
- Syntax errors
- Invalid object names (tables, columns, procedures)
- Type mismatches and schema errors
Validation runs against the first selected server/database. Results appear in a dialog showing errors and warnings with line numbers, severity, and error numbers.
Execution Modes
The execution options bar at the top controls how scripts are dispatched:
Instance Mode
| Mode | Behavior | Best For |
|---|---|---|
| Sequential (default) | One server at a time, in order | Data-modifying scripts, cautious rollouts |
| Parallel | All selected servers concurrently | Read-only queries across many servers |
Database Mode
| Mode | Behavior | Best For |
|---|---|---|
| Sequential (default) | One database at a time per server | Safe default for all scenarios |
| Batched | N databases concurrently per wave (configurable batch size) | Balanced speed & resource control |
Error Handling & Resilience
| Mode | Behavior |
|---|---|
| Continue on Error (default) | Proceeds through all targets, logs failures |
| Stop on Error | Halts remaining execution after first failure |
Per-target SQL failures are captured in results and the execution log — they do not crash the application. Unexpected UI or background faults are caught globally, logged under CrashLogs, and shown in a dialog so the app can keep running.
GO Batch Splitting
- Scripts are split on standalone
GOlines (case-insensitive) - GO with repeat count:
GO 5runs the preceding batch 5 times GOinside string literals, block comments, and line comments is correctly ignored- False positives like
GOTOorGOPHERare not treated as separators - Empty batches are automatically skipped
- Each batch has a 300-second command timeout
Results & Execution Log
Script Results Tab
All result rows merged into a data grid with two auto-prepended columns: Instance Name and Database Name. When running multiple scripts from a folder, each script gets its own sub-tab. Supports sorting and column resizing.
Execution Summary Tab
| Column | Description |
|---|---|
| Status | ✓ Success (green) or ✗ Failed (red) |
| Script | Script filename (folder mode) |
| Group / Server / Database | Target details |
| Rows | Rows returned or affected |
| Duration | Execution time per target |
| Error | Error message (if failed) |
Filter by All Results, Success Only, or Errors Only using the dropdown.
Execution Log Tab
Timestamped, auto-scrolling log showing every action: script loading, per-target success/failure, cancellation, and final summary. Includes start / success / error / stop markers. PRINT and RAISERROR info messages from SQL Server are captured and shown in the log.
Exporting Results
Excel Export
- Professional formatting: dark blue headers, alternating row shading, auto-sized columns
- Color-coded status (green = success, red = failure)
- Sheet modes: Single Sheet, Sheet Per Group, Sheet Per Server, Sheet Per Database, Sheet Per Script
- Choose what to include: Results, Summary, Execution Log
CSV Export
UTF-8 CSV with proper escaping. Optionally includes execution summary and log sections.
Multi-Tab Sessions
Run multiple independent execution sessions simultaneously. Each session has its own:
- Server/database selection (independent checkboxes)
- Script content or folder path
- Include DBs scope and include/exclude lists
- Execution mode and error handling settings
- Results, summary, and log
Click + in the session tabs to add a new session. New sessions inherit settings from the active session. Use Templates next to + to open a template in a new session.
Themes & UI
- Dark / Light theme — toggle from the title-bar sun/moon button, or choose Dark/Light in Settings. Preference is saved.
- Fluent-style chrome aligned with other DBLense desktop tools (custom title bar, branded ScriptRunner accent).
Import / Export Server Registrations
Share your server group configuration with team members via Settings → Server Registrations:
- Export — Saves all groups and server names to a portable JSON file. No credentials are included.
- Import — Load a JSON file and choose to Merge with existing registrations or Replace all. Credentials will need to be configured after import.