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

FieldDescription
Server NameFull server/instance name (e.g., SQLPROD01, myserver.database.windows.net)
Display NameOptional short label for long Azure MI names. Full name shown as tooltip.
AuthenticationChoose from four modes (see below)
Login / PasswordRequired 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.
Tip: Include DBs is not the same as selecting servers. Scope only decides which databases get auto-checked under servers you already selected.

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.

ScopeAuto-checks
User databases (default)Only user databases (excludes master, model, msdb, tempdb)
All databasesEvery online database on the server
System databasesOnly system databases
master onlyOnly 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.

Tip: If databases haven't been expanded yet for a server, execution auto-queries databases and applies the active scope (or falls back to 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:

  1. Switch to the Script Folder tab
  2. Click Browse... and select a folder
  3. All .sql files are listed with checkboxes, filename, size, and routing info
  4. Use Select All / Deselect All to toggle; reorder with ▲/▼ buttons
  5. Click Execute or Validate

Scripts execute in the order shown (alphabetical by default, reorderable). Results are grouped per-script in separate tabs.

DBLense Script Runner → Script Folder tab showing file list with routing indicators
Script Folder tab: browse a directory of .sql files, select/reorder, validate, and execute across all targets

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 FilenameRouting
report@PROD01--Northwind.sqlRuns only on PROD01 / Northwind
cleanup@PROD01.sqlRuns on PROD01, all databases
index_rebuild@--SalesDB.sqlRuns on all servers, SalesDB only
report.sqlIn 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)
Tip: Prefer the comment directive for Azure Managed Instance names that contain dots and are awkward in filenames.

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.

Tip: Always validate before running scripts on production — especially migration scripts in folder mode.

Execution Modes

The execution options bar at the top controls how scripts are dispatched:

Instance Mode

ModeBehaviorBest For
Sequential (default)One server at a time, in orderData-modifying scripts, cautious rollouts
ParallelAll selected servers concurrentlyRead-only queries across many servers

Database Mode

ModeBehaviorBest For
Sequential (default)One database at a time per serverSafe default for all scenarios
BatchedN databases concurrently per wave (configurable batch size)Balanced speed & resource control

Error Handling & Resilience

ModeBehavior
Continue on Error (default)Proceeds through all targets, logs failures
Stop on ErrorHalts 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 GO lines (case-insensitive)
  • GO with repeat count: GO 5 runs the preceding batch 5 times
  • GO inside string literals, block comments, and line comments is correctly ignored
  • False positives like GOTO or GOPHER are 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

ColumnDescription
Status✓ Success (green) or ✗ Failed (red)
ScriptScript filename (folder mode)
Group / Server / DatabaseTarget details
RowsRows returned or affected
DurationExecution time per target
ErrorError 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.
Tip: Place the exported JSON on a shared network drive so your entire DBA team uses the same server list.