On this page
Command reference
Officially documented BroadSQL commands: keyword, description, and its aliases, grouped by category. Generated from the source code at release time: click through for arguments, examples, and full notes.
Overview
95 commands across 14 categories.
| Category | Description | Commands |
|---|---|---|
| Connections | Connect to databases and manage saved connections. | 12 |
| Database Groups | Group related database connections. | 5 |
| Environments | Define DEV, QA, PROD and other environments. | 5 |
| Login Scripts | Configure SQL automatically executed when a connection opens. | 5 |
| Running Queries | Execute SQL and work with query results. | 7 |
| Database Exploration | Explore schemas, tables, columns and database metadata. | 16 |
| Export & Local Data | Export and preserve data using Excel, ODS, CSV, H2 and more. | 3 |
| Data Import | Import data into existing database tables. | 1 |
| Scripts Library | Run and manage reusable Scripts: text files of SQL and BroadSQL commands. | 15 |
| Light Scripting (JS) | Run and manage JavaScript against query results. | 4 |
| Session & Settings | Control the BroadSQL session and display behavior. | 6 |
| API Client | Configure, import, browse and execute HTTP API endpoints with the Universal API Client. | 10 |
| General | Basic session tools: HELP, VERSION, CONFIG, CLS, PRINT. | 6 |
| Extension Commands | BroadSQL does not currently ship with any extension commands. This category is reserved for commands provided through BroadSQL's extension mechanism and may include optional commands in future releases. | 0 |
Related topics
| Patterns | Use files, clipboard, spreadsheets and previous query results in SQL, not commands of their own, so not listed in a category below. |
Connections
Connect to databases and manage saved connections.
| Command | Description | Aliases |
|---|---|---|
ADD CONNECTION |
Creates a new database connection | ADD CO, ADDCO, AD CO, ADCO |
CONNECT |
CONNECT <id> opens a physical connection to a database defined in the Connections Definition File. Aliases: OPEN, CON, CONN. To switch to another Environment of the current Database Group instead, use ENV <environment>. CONNECT API <api>:<environment> establishes an active API session context instead - the API and environment RUN and SHOW ENDPOINTS use when none is repeated on the command line. The two contexts are entirely independent: connecting to an API never closes or replaces the current database connection, and connecting to a database never clears an active API context. The prompt shows both when both are active, for example $CDF [API DESK:PROD]>. Use DISCONNECT API to clear only the API context. | OPEN, CONN, CON |
DEL CONNECTION |
Deletes an existing database connection | DEL CO, DELCO, DE CO, DECO |
DISCONNECT |
DISCONNECT (or BYE, or CLOSE) reconnects to the Connections Definition File, closing whatever database connection was open. DISCONNECT API clears only the active API session context established by CONNECT API, without affecting the database connection at all. If there is no active API context, DISCONNECT API is a no-op. | BYE, CLOSE |
DUPLICATE CONNECTION |
Duplicates an existing database connection under a new ID | DUP CO, DUPCO |
EDIT CONNECTION |
Edits an existing database connection | ED CO, EDCO |
LOGOUT |
Prompts user for authentication | |
PING |
Tests a database connection | CHECK |
REACTIVATE CONNECTION |
Reactivates an inactive database connection | REACT CO, REACO |
SHOW ALL CONNECTIONS |
Displays list of all database connections in the CDF file | SH ALL CO, SH AL CO, SHALLCO, SHALCO |
SHOW CONNECTION |
Shows details about a specified connection | SH CO, SHCO |
SHOW INACTIVE CONNECTIONS |
Displays list of all inactive database connections in the CDF file | SH INACT CO, SHINACO |
Database Groups
Group related database connections.
| Command | Description | Aliases |
|---|---|---|
ADD GROUP |
Creates a new Database Group | ADD GR, ADDGR |
DEL GROUP |
Deletes an existing Database Group | DEL GR, DELGR |
EDIT GROUP |
Edits an existing Database Group | EDIT GR, EDGR |
SHOW ALL GROUPS |
Shows all configured Database Groups | SHALGR |
SHOW GROUP |
Shows all environments for a given Database Group | SHOW ENVIRONMENTS, SH ENV, SHENV, SHOW ENVTS |
Environments
Define DEV, QA, PROD and other environments.
| Command | Description | Aliases |
|---|---|---|
ADD ENVIRONMENT |
Creates a new Environment | ADD ENV, ADDENV |
DEL ENVIRONMENT |
Deletes an existing Environment | DEL ENV, DELENV |
EDIT ENVIRONMENT |
Edits an existing Environment | EDIT ENV, EDENV |
ENV |
ENV <environment> resolves the Environment in the current connection's Database Group and connects to the physical Connection mapped to it, exactly as CONNECT <connection> would (same checks, prompt and login script). It never searches other Database Groups: without a current Database Group it fails. CONNECT <name> always means a physical Connection, so a Connection and an Environment with the same name never conflict. Aliases: ENVT, CONNECT ENVIRONMENT. | ENVT, CONNECT ENVIRONMENT |
SHOW ALL ENVIRONMENTS |
Shows the globally configured Environments | SHALENV, SHOW ALL ENVTS |
Login Scripts
Configure SQL automatically executed when a connection opens.
| Command | Description | Aliases |
|---|---|---|
ADD LOGIN SCRIPT LINE |
Appends a new line to an existing connection's login script | ADD LOG SC LI, ADDLOGSCLI |
DEL LOGIN SCRIPT LINE |
Deletes a line from a connection's login script | DEL LOG SC LI, DELLOGSCLI |
EDIT LOGIN SCRIPT LINE |
Edits an existing line of a connection's login script | EDIT LOG SC LI, EDLOGSCLI |
MOVE LOGIN SCRIPT LINE |
Moves a line of a connection's login script up or down by one position | MOVE LOG SC LI, MOVLOGSCLI |
SHOW LOGIN SCRIPT |
Displays the login script of an existing database connection | SH LOG SC, SHLOGSC |
Running Queries
Execute SQL and work with query results.
| Command | Description | Aliases |
|---|---|---|
ALL |
Displays all rows from a table | |
CNT |
Displays result of a SELECT COUNT(*) for a table | |
EDIT |
Opens the BroadSQL Editor, the native workspace for browsing, editing, formatting, validating, running and versioning the Scripts Library; with a name, opens/focuses that Script | ED |
EXPAND |
Replaces the current SQL's SELECT * / alias.* projection with real column names from database metadata | |
FORMAT |
Reformats the current SQL for readability without changing its meaning | |
REPEAT |
Runs a query, a block of queries or a script again and again, in the foreground, to watch something change. The parts always come in this order: REPEAT [<target>] EVERY <interval> [FOR <duration> | COUNT <iterations>] [TO <file> [AS CSV|JSON|TEXT]]. The target is nothing or / (the last query), BEGIN <query>; ... END (a block of queries run in order), @<script> or LIB RUN <script>. The first iteration starts at once; EVERY is the wait after each iteration ends, so iterations never overlap. Durations are a whole number followed by s, m or h (10s, 5m, 2h). Only queries can be repeated. Ctrl+C stops it. | |
SHOW QUERY |
Displays the current SQL query stored in memory | SH QU, SHQU |
Database Exploration
Explore schemas, tables, columns and database metadata.
| Command | Description | Aliases |
|---|---|---|
COMPARE TABLE STRUCTURE |
Compares the column structure of a table between the current connection and another connection | CM TA ST, CMTAST |
DESCR |
Describes the structure of the table | DESC, DESCRIBE |
FIND COLUMN |
Shows tables having a column name that contains the input text | FI COL, FICOL, SHOW COLUMN, SH COL, SHCOL |
FIND FK |
Finds foreign keys whose name, tables or columns contain the input text | FIND REFERENCE, FIND REFERENCES, FI FK, FIFK |
FIND INDEX |
Finds indexes whose name, table or columns contain the input text | FIND INDEXES, FI IX, FIIX |
LINK TABLE |
Links a table of another connection into the current H2 database | LINKT |
SHOW CATALOGS |
Displays a list of catalogs in the current database | SH CA, SHCA |
SHOW DBINFOS |
Displays current database properties | SH DBIN, SHDBIN |
SHOW DRIVERS |
Lists available JDBC drivers | SH DR, SHDR |
SHOW FK |
Shows the foreign keys declared by a table and what they reference | SHOW FOREIGN KEYS, SH FK, SHFK |
SHOW INDEXES |
Shows the indexes of a table, their columns and whether they are unique | SHOW INDEX, SH IX, SHIX |
SHOW PK |
Shows the primary keys for a given table name | SHOW PRIMARY KEYS, SH PK, SHPK |
SHOW REFERENCES |
Shows the foreign keys of other tables that reference a table | SHOW REFS, SH REF, SHREF |
SHOW SCHEMAS |
Displays a list of schemas in the current database | SH SC, SHSC |
SHOW TABLES |
Displays the tables (not the views) whose schema and name match the entered pattern | SH TA, SHTA |
SHOW VIEWS |
Displays all views whose schema and name match the entered pattern | SH VI, SHVI |
Export & Local Data
Export and preserve data using Excel, ODS, CSV, H2 and more.
| Command | Description | Aliases |
|---|---|---|
COPY RESULT |
Copies the most recently produced result, SQL query or RUN, whichever ran last, to the system clipboard as tab-separated text, ready to paste into Excel/Calc | |
DUMP |
DUMP is the export command. DUMP <table>, DUMP / (the previous result, as displayed, without running the query again), DUMP (<query>) and DUMP LIB <script> or DUMP @<script> (the final result of a Scripts Library script) all accept [TO <destination>] [AS <format>]. Formats: CSV (comma or semicolon, from the CsvSeparator setting), TEXT (UTF-8, tab separated), JSON, XLSX and ODS (worksheet DATA unless named, e.g. TO report.MONTHLY), H2, MD and HTML. Without AS, the DefaultFileFormat setting applies; without TO, the file is named after the table, the script, or DefaultExtFileName (results). Files are written to the export folder (DefaultFolder). PULL is a compatibility alias of DUMP. DUMP / exports only a result displayed in full (never cut at MaxRowsOnScreen) and never runs the query again. DUMP <table> alone keeps its original file naming: format from DefaultFileFormat, or tab separated text beyond MaxRowXLSX rows. For AS H2, XLSX and ODS, MODE APPEND adds the rows to the existing table or worksheet when it has the same columns, with the same names, in the same order as the result (types are not compared, any query can be appended); a missing destination is created. The Connections Definition File ($CDF) cannot be a destination. | |
PULL |
PULL is kept so existing scripts keep running; DUMP is the export command to use and document. PULL runs exactly like DUMP (same sources, optional TO, formats, defaults and files, see HELP DUMP): PULL / exports the displayed result and never runs the query again. AS H2 reuses or creates the named H2 connection; MODE OVERWRITE (the default) recreates the table, MODE APPEND KEY(<column>) [FORCE] inserts only rows whose key is greater than the target's current maximum, MODE APPEND (no KEY) adds every row when the table has the same columns, names and order as the result, and every run is recorded in BROADSQL_PULL_AUDIT. AS XLSX and AS ODS replace one worksheet (or append to it with MODE APPEND) and keep a QUERIES worksheet; they accept a trailing OPEN to open the file afterwards. The Connections Definition File ($CDF) cannot be a destination. |
Data Import
Import data into existing database tables.
| Command | Description | Aliases |
|---|---|---|
LOAD |
Loads records from a source file into a table using safe, parameter-bound INSERT statements. Every value is bound through a JDBC PreparedStatement parameter, never concatenated into SQL text, and the target table/columns are resolved against real database metadata before any SQL is built. PREVIEW validates without writing; a plain LOAD asks for confirmation before writing (default No) unless running inside a script, where it requires EXECUTE instead. Any unrecognized source column, or any row that fails to convert, refuses the whole load; there is no partial load of only the valid rows. | LO |
Scripts Library
Run and manage reusable Scripts: text files of SQL and BroadSQL commands.
| Command | Description | Aliases |
|---|---|---|
@ |
The preferred, concise way to run a Script, a text file of SQL statements and BroadSQL commands. @foo.bsql runs a Script from the Scripts Library, @./foo.bsql runs a file relative to the working directory (or to the running Script's own directory when written inside a Script), and @C:\temp\foo.bsql runs a file anywhere. No extension is ever added. Arguments are named, name=value, and read in the Script as ${name}. |
|
ECHO |
Prints a message, at the prompt or in a Script. The message is exactly one single-quoted string: '' prints an apostrophe, ${name} prints a SQL scripting variable's value, $${ prints ${. Never hidden by OUTPUT QUIET. | |
LET |
Assigns a SQL scripting variable, at the prompt or in a Script. The value is a number, a single-quoted string, TRUE, FALSE, NULL, one variable reference ${other} (an exact copy), or a query starting with SELECT, WITH or VALUES that returns exactly one row and one column. Use the variable in SQL as ${name}: it is sent as a typed parameter, never pasted into the SQL text. Variables are shared by the prompt and every Script of the session. List them with SHOW SCRIPT VARIABLES. LET is unrelated to VAR, which sets API variables used by API requests only. | |
LIB DEL |
Archives (soft-deletes) a Script in the Scripts Library, after confirmation; see LIB UNDO / LIB RESTORE | LI DE, LIDE |
LIB EDIT |
Opens a Scripts Library script in the BroadSQL Editor (nothing is saved by opening it) | LI ED, LIED |
LIB FIND |
Full-text, case-insensitive search across the whole Scripts Library (content, not just paths), regardless of Database Group or environment | LI FI, LIFI |
LIB LINT |
Checks the Scripts Library for consistency issues: unknown @instance/@environment ids, invalid @params, legacy %1..%9 parameters, ${name} inside quotes | LI LN, LILN |
LIB LIST |
Lists the Scripts in the Scripts Library (subfolders included), scoped to the current connection's Database Group and environment by default | LI LI, LILI |
LIB RESTORE |
Restores a specific archived (LIB DEL) Script | LI RS, LIRS |
LIB RUN |
Runs a Script stored in the Scripts Library, the same way @ does. The name is a path relative to the library root, exactly as written: LIB RUN maintenance/foo.bsql runs maintenance/foo.bsql. No extension is added and the path cannot leave the library. Arguments are named, name=value, and read in the Script as ${name}. |
LI RU, LIRU |
LIB SHOW |
Displays a Script from the Scripts Library | LI SH, LISH |
LIB UNDO |
Restores the most recently archived (LIB DEL) Script | LI UN, LIUN |
ON ERROR |
In a Script, stops at the first failed statement (STOP) or continues (CONTINUE, the default) | |
OUTPUT |
In a Script, hides routine output (QUIET) or shows it again (NORMAL, the default) | |
SHOW SCRIPT VARIABLES |
Lists the SQL scripting variables of the session (set with LET or as Script arguments) |
Light Scripting (JS)
Run and manage JavaScript against query results.
| Command | Description | Aliases |
|---|---|---|
JS EVAL |
Runs a short piece of JavaScript typed directly on the command line | JS EV, JSEV |
JS FIND |
Full-text, case-insensitive search across the whole JS scripts catalog (content, not just file names), regardless of Database Group or environment | JS FI, JSFI |
JS LIST |
Displays the list of files in the JS scripts catalog, scoped to the current connection's Database Group and environment by default | JS LI, JSLI |
JS RUN |
Runs a saved .js script from the JS scripts catalog, optionally passing positional arguments | JS RU, JSRU |
Session & Settings
Control the BroadSQL session and display behavior.
| Command | Description | Aliases |
|---|---|---|
SET AUTOCOMMIT |
Turns autocommit ON or OFF | SE AU |
SET LIST |
Sets the display mode of query resuls: OFF=tab view (default), ON=form view | SELI |
SET MASTER PASSWORD |
Changes the master password for the Connections Definition File | SET MAPA |
SET PASSWORD |
Changes the password of the current connection | SE PA |
SET SCHEMA |
Selects a different schema | SE SC, SESC |
SHOW AUTOCOMMIT |
Displays autocommit setting for the current connection | AUTOCOMMIT, SH AU, SHAU |
API Client
Configure, import, browse and execute HTTP API endpoints with the Universal API Client.
| Command | Description | Aliases |
|---|---|---|
CONFIG API |
Opens the API Configuration window: manage APIs, environments (base URL, variables), authentication (Inherit/None/Basic/Bearer/API Key/OAuth2 Client Credentials), variables and headers, folders and endpoints (every HTTP method, plus an optional BroadSQL alias reserved for future script usage), and Bruno YAML import/export, all without hand-editing SQL or the underlying metadata tables. This GUI only configures APIs; it never executes a request (see RUN for that). Same Windows-only, $CDF-only gate as CONFIG. | |
IMPORT API BRUNO |
Imports a bundled OpenCollection YAML (Bruno) API collection into BroadSQL's API catalog: creates the API (with environments, folders, and endpoints of every HTTP method) if it does not exist yet, or safely re-imports into an existing one: an object present in the source is created or updated, an object from a previous import no longer present in the source is left untouched, never deleted. Every HTTP verb is imported and listed by SHOW ENDPOINTS; GET, HEAD, POST, PUT, PATCH, and DELETE can be executed (RUN refuses OPTIONS and any other verb). Scripts, assertions and request/response automation are never imported. Only the bundled (single-file) OpenCollection YAML format is supported. | |
RUN |
URL-native execution: the relative URL is resolved against the currently connected API (CONNECT API <api>:<environment>; first); RUN never takes an explicit API/environment clause of its own. HTTP_METHOD is optional and defaults to GET; DELETE/POST/PUT/PATCH/HEAD/OPTIONS and other configured methods can be given explicitly, e.g. RUN DELETE /api/customer/123;. A :name segment/query value is resolved, in order: a matching session VAR, the current API environment's own variable, this endpoint's persisted CONFIG API value, its configured default, or a clear missing-parameter error; a literal value (e.g. 123) is used directly. ${name}/{{name}} (API/environment variable templating, the same syntax already used inside a stored endpoint's own definition) also resolves directly in the typed URL now, against the connected API's active environment, before endpoint matching happens (so it can affect which endpoint a URL matches). ${ENV:NAME} reads an operating-system environment variable at invocation time instead (undefined fails explicitly, never silently substitutes an empty string); this is a different, unrelated namespace from ${name}. An endpoint's id, alias (CONFIG API), or name is a completion/discovery shortcut only: RUN <reference>; with no query/tab-expansion is rejected with a hint toward SYNTAX <reference>; or RUN <reference><TAB>, never executed directly. Most imported endpoints never have an alias set at all, only a name and a numeric id, and completion works from any of the three. Query parameters are URL-native: only what is written in the URL is sent (plus any required parameter with no value in the URL that can still be resolved via VAR/persisted/default), never a configured-but-unmentioned optional query parameter. The optional trailing TABLE/RAW clause selects the response rendering exactly as before; the default remains a complete LIST view. | |
SHOW ALL APIS |
Lists every API as a bordered table: ID, NAME, TYPE (Manual, or Bruno YAML for an imported API), and DESCRIPTION. Long values may be ellipsized for display; the persisted value itself is never truncated. See SHOW ENDPOINTS to list one API's endpoints, and SHOW API ENVIRONMENTS to list its environments. | SHALAP, ALL APIS |
SHOW API ENVIRONMENTS |
Lists every environment defined for one API as a bordered table: ID, NAME, BASE URL. Never shows a secret environment variable, only these non-secret fields. Use CONNECT API <apiId>:<environment> then RUN <url> to execute against one of these. See SHOW API ENVIRONMENT for the detail of one environment (including its variables) instead of this list. | SHAPENV, ALL ENVT, ALL ENV |
SHOW API ENVIRONMENT |
Always scoped to the active CONNECT API session's API. With no argument, shows the session's own connected environment; with an environment name, shows that named environment of the same API instead. This is a runtime/session-scoped read only: it does not depend on, and this sprint does not introduce, any persisted 'current environment' concept; CONNECT API remains the sole source of which environment is active. Shows enough information to diagnose ${name}/{{name}}/:name variable substitution: id, name, base URL, and every variable (name, value, enabled/disabled) with a secret value masked, never shown in full. | SHAPIENV |
SHOW ENDPOINTS |
Lists endpoints as a table (ID, VERB, FOLDER, NAME, ALIAS). With API <apiId>, targets that API directly: no active session required. Without it, lists the active CONNECT API session's API, revalidating its status on every call (a session can outlive the API it points at being deactivated via CONFIG API in the meantime). A bare HTTP method (e.g. GET) filters on that exact, case-insensitive verb, the canonical form; the legacy VERB <verb> form is still accepted for backward compatibility. MATCH <keyword> filters on a case-insensitive substring over folder, name, and alias combined; both filters may be combined, in either order, after API <apiId> (or first, when API is omitted). The numeric ID or an assigned alias is what SHOW ENDPOINT/SYNTAX/HELP take to select an endpoint unambiguously, since duplicate endpoint names across different folders are normal. See also SHOW ENDPOINT <id> for a single endpoint's full detail (URL, headers, parameters, body). | ENDPOINTS, ALL ENDPOINTS, SHENDS |
SHOW ENDPOINT |
Shows one endpoint's full detail as a vertical view (the same collection => table, single object => detail-view convention as SHOW CONNECTION): ID, owning API, folder, name, alias, method, and the composed effective URL (base path plus enabled query parameters plus fragment, the same composition the CONFIG API endpoint editor and RUN's request builder use). Then, where present: query parameters and path parameters (name, value, enabled/disabled; a value flagged secret is masked), headers (same masking rule), the request body (mode and full content), and an authentication summary (type only, or 'Inherited', never a resolved credential value). The argument accepts a numeric id (global, unique across every API, no active session needed), an alias, or a name (both scoped to the active CONNECT API session's API). A name matching more than one endpoint is reported as an ambiguous-candidates table instead of being guessed at; use the id or alias in that case. | ENDPOINT, SHEND |
SYNTAX |
Generated entirely from the endpoint's own stored parameter metadata (CONFIG API), never a separately maintained syntax string, so it can never drift from what RUN actually accepts. Requires an active CONNECT API session (unlike SHOW ENDPOINT, even a numeric id is scoped to that session's API here). Shows the canonical colon-style URL, every required path/query parameter, optional query parameters with their allowed values, and both a literal and a parameterized (VAR-based) RUN example. The argument accepts a numeric id, an alias, or a name; a name matching more than one endpoint is reported as an ambiguous-candidates table instead of being guessed at, same as SHOW ENDPOINT. | |
VAR |
Creates or replaces a temporary, session-only variable, looked up case-insensitively by RUN for a matching :name path or query placeholder; this is step 1 of the resolution precedence, ahead of the current API environment variable, this endpoint's persisted CONFIG API value, and its default (section 7.3, extended by SPRINT XT02B section 4.3). A value may reference ${ENV:NAME} (an operating-system environment variable), resolved once at assignment time; an undefined environment variable fails explicitly. A value containing spaces must be double-quoted. With the trailing PERSIST keyword (requires an active CONNECT API session): instead of a session variable, upserts the value into the current environment's variable set (the same store CONFIG API's Environment tab edits) by case-insensitive name, preserving every other field of an existing row, then clears any session VAR of the same name so the newly persisted environment value is what every subsequent command sees, immediately, through the normal resolution chain. VAR sets API variables only: they are not visible in SQL. SQL scripting variables, used in SQL as ${name}, are set with LET. |
General
Basic session tools: HELP, VERSION, CONFIG, CLS, PRINT.
| Command | Description | Aliases |
|---|---|---|
CLS |
Clears the screen | CLEAR |
CONFIG |
Displays the GUI for maintaining connections (Windows only) | |
HELP |
Displays a list of supported command categories, or help for a specified command/category | |
PRINT |
Prints text. Unquoted words are joined with ", "; quote the text to print it verbatim. In Scripts, prefer ECHO 'message', which prints the text exactly as written and can include ${name} variable values. | PRNT |
SHOW EXTENSION ERRORS |
Lists the extension and command loading failures recorded at startup | |
VERSION |
Displays the current version of BroadSQL | VERS |
Extension Commands
BroadSQL does not currently ship with any extension commands. This category is reserved for commands provided through BroadSQL's extension mechanism and may include optional commands in future releases.
BroadSQL