@
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}.
Arguments
<script> (mandatory) a Scripts Library path, ./relative path, or absolute path, then optional name=value arguments
Examples
@maintenance/cleanup.bsql
@./helper.bsql
@reports/customer.bsql customer_id=42 country='FR'
@"C:\My Scripts\foo.bsql" since=${last_run}
Notes
Runs a Script: @<reference> [name=value ...]. The preferred, concise way to execute a Script.
A Script is a text file of SQL statements, BroadSQL commands, or both, separated by ;. The file extension means nothing to BroadSQL. The reference is resolved the same way for every command and the editor.
@foo.bsql and @maintenance/foo.bsql are relative to the Scripts Library root, never to the working directory, and no extension is ever guessed: @foo is the file named foo.
@./foo.bsql is relative to the working directory when typed at the prompt, and to the directory of the running Script when written inside a Script, so a folder of Scripts can be moved as a bundle.
@C:\temp\foo.bsql or @/tmp/foo.bsql is an explicit path to a Script outside the library. Quote a reference that contains spaces.
Arguments are named: @report.bsql customer_id=42 country='FR'. Each one assigns a SQL scripting variable before the Script starts, exactly like LET customer_id = 42;, and the Script reads it as ${customer_id}. A value is a number, a single-quoted string, TRUE, FALSE, NULL or one ${other} variable. Every value is computed before any is assigned, and a call that fails assigns none of them. There is no limit on the number of arguments. Assigned values remain in the session after the Script returns. A Script can require arguments with a -- @params: customer_id, country comment line: each call must then pass them explicitly.
Positional parameters %1 to %9 were removed: @report.bsql 42 FR now fails with an explanation. Write @report.bsql customer_id=42 country='FR' and use ${customer_id} in the Script.
At the end of a Script started at the prompt, a status line gives the result (SUCCESS, COMPLETED_WITH_ERRORS, FAILED or CANCELLED), the number of statements run and failed, and a run identifier. Execution is shared with LIB RUN and the BroadSQL Editor.
See Running Scripts, and the Scripting overview for variables, named arguments, ECHO, OUTPUT, ON ERROR and nested Scripts.
Last modified in release 5.3.3.
BroadSQL