Syntax and shortcuts

BroadSQL adds a few forms to the SQL you type that are not commands: shortcuts that run a query again, list sources that expand to a list of values, and variables. This page lists them all in one place; each row links to the section that explains it.

FormWhat it doesExampleDetails
;Ends every command, BroadSQL's own or SQL. A command may span several lines; it runs at its closing ;. A ; inside a quoted value is text.SELECT 1; SELECT 2;Entering commands
/Runs the last SQL statement again, on the current connection. Typed on a line by itself./Patterns: /
/ <environment>Runs the last SQL statement once on the connection of another Environment of the same Database Group, without switching./ PRODPatterns: / <environment>
//Shows the last query on one line without running it, like SHOW QUERY.//Entering commands
@<script> [name=value ...]Runs a Script: a plain name is in the Scripts Library, ./ is next to the current Script or the working directory, an absolute path is anywhere.@countries/largest.sql continent='Europe'Running Scripts
${name}A Script variable or argument, sent to the database as a typed value, never pasted into the SQL text.WHERE CONTINENT = ${continent}Variables
<@file>Expands to the values of a text file, one per line, quoted and separated by commas.WHERE ID IN <@ids.txt>Patterns: <@fileName>
<@csv:<path>:<column>>Expands to the values of one named column of a CSV file.IN <@csv:c:\temp\review.csv:COUNTRY_CODE>Patterns: <@csv:...>
<@excel:<path>:<sheet>:<column>>Expands to the values of one named column of one sheet of an .xlsx workbook.IN <@excel:c:\temp\review.xlsx:Countries:COUNTRY_CODE>Patterns: <@excel:...>
<@last:<column>>Expands to the values of one column of the result you just displayed, so one query feeds the next.IN <@last:CODE>Patterns: <@last:...>
<@clipboard>Expands to the values on the clipboard, one per line: a column copied from a spreadsheet or a ticket.IN <@clipboard>Patterns: <@clipboard>
-- and /* */Comments, ignored in Scripts. A -- line at the top of a Script may hold a directive.-- monthly checkRunning Scripts
exitEnds BroadSQL and closes every connection cleanly. Lowercase, without ;.exitEntering commands
:nameIn a RUN URL, a runtime placeholder resolved for that call: a session VAR first, then the API environment, then the endpoint's saved value or default.RUN /users/:idAPI variables
${ENV:NAME}In an API definition, the value of an operating system environment variable, for example a token.${ENV:CRM_TOKEN}API variables

Rules for every line

  • A command ends with ;, and may span several lines. Several commands may share a line; when one fails, the ones after it on that line are not run.
  • /, / <environment>, // and exit are typed on a line by themselves, without ;.
  • A list source starts at <@ and ends at the first > after it, on the same line. Inside a quoted string or a comment, <@ is ordinary text.
  • ${name} is replaced by a typed value sent to the database, never by text: write WHERE ID = ${id}, without quotes around it.
  • In a Script, statements are split at ; only, so a procedural block that contains ; is split too.

Choosing a shortcut

Choose the right way to run something again The last query, here: slash. The last query, once, in another Environment of the same Database Group: slash PROD. Keep working in that Environment: ENV PROD. A query or routine you saved: at script with arguments. The same query again and again, to watch it: REPEAT EVERY 10s. Logic, loops or several connections: JS RUN. What do you want to run again? The last query, here/ It, once, in PROD/ PROD Work in PROD for a whileENV PROD; A saved query or routine@report.sql year=2026; The same, every 10 secondsREPEAT EVERY 10s; With logic or two connectionsJS RUN f.js; same Database Group, you stay here a Script of the Scripts Library until Ctrl+C, FOR or COUNT experimental

Found something wrong or unclear on this page? , with the page address.