SQL Script Control Commands (FireDAC)
Go Up to Executing SQL Scripts (FireDAC)
Contents
Description
Command | Description |
---|---|
(@ | @@ | START | INput) <script> [<arguments>] | Starts the execution of the specified script.
'@@' executes a script with a file name relative to parent script path. <arguments> is a comma-separated list of values. If not specified, the parent arguments will be inherited. |
ACCept (NUMber|CHAR|DATE) [FORmat <fmt>] [DEFault <def>] [PROmpt '<prompt>' | NOPRompt] [HIDE] | Asks user to enter a parameter value.
NUMber|CHAR|DATE--optional value type. FORmat <fmt>--Delphi-format string used to parse DATE values. DEFault <def>--default value, when a user entered an empty string. PROmpt '<prompt>' | NOPRompt--prompts to output to console. |
CONnect <FireDAC connection string> | Connects to the specified DBMS - OpenConnection. |
COPY FROM (FILE '<file>' | SQL '<sql>' [CONnect '<connection>']) TO (FILE '<file>' | TABle '<table name>' [CONnect '<connection>']) [TRUNCate | CLEar | ALWAYSinsert | APPend | UPDate | APPENDUPDate | DELete] [LOG (OFF | (SPOol|OUTput) | ([APPend] <log file name>)] [USING (FILE 'config file' | PARAMS '<definition>')] | Moves data between databases or text files. There:
|
DEFine [<name> | <name>=<value>] | DEFINE without name--prints all macros.
DEFINE <name>--prints the specified macro. DEFINE <name>=<value>--sets the specified macro value. |
DELIMiter <text> | Sets the script command separator, ScriptOptions.CommandSeparator. |
DISconnect | Disconnects from the DBMS by using CloseConnection. |
EXECute | CALL) <procedure> | Executes the specified stored procedure. |
EXIT | Stops the script execution and commits the changes. |
QUIT | Stops the script execution and rollback the changes. |
STOP | Stops the script execution. |
HELP | Shows the help for all registered commands. |
(HOst | !! | SHELL) <command> | Executes the host shell command. For Windows, the ShellExecute('open', ACommand) call is used. |
PAUse <prompt> | Prints the specified prompt and pauses the script execution. |
PROmpt <prompt> | Prints the specified text. |
PRInt [..., <varN>] | Prints the value of the specified parameters. |
REMark <text> | Adds a comment to the script. |
SET ARRAY <value> | Specifies the rowset size - FetchOptions.RowsetSize. |
SET AUTOcommit OFF|ON|<value> | Sets the autocommit mode off, on or to commit each N commands - ScriptOptions.CommitEachNCommands. |
SET AUTOPrint OFF|ON | Shows the parameter values after the command execution - ScriptOptions.AutoPrintParams. |
SET BREAK OFF|ON | Stops the script execution on error - ScriptOptions.BreakOnError. |
SET (CMDSeparator | TERMinator) <value> | Specifies the commands separators - ScriptOptions.CommandSeparator. TERM is for IB/FB only. |
SET (DEFine | SCAN) OFF|ON | Controls the macros expansion - ScriptOptions.MacroExpand. |
SET DROPnonexistent ON|OFF | Allows dropping non-existent objects - ScriptOptions.DropNonexistObj. |
SET ECHO OFF|(ON [SQL|ALL] [TRIM 50|<value>]) | Outputs command text before executing it with optional trimming - ScriptOptions.EchoCommands, EchoCommandTrim. |
SET ENCoding ANSI | UTF8 | UTF16 | Sets the SQL script and log files encoding - ScriptOptions.FileEncoding. |
SET (FEEDback|COUNT) 6|<value>|OFF|ON | Outputs the feedback after the command execution - ScriptOptions.FeedbackCommands. |
SET HEAding OFF|ON | Outputs the column names for a result set - ScriptOptions.ColumnHeadings. |
SET LINESize 0|<value> | Sets the line width - ScriptOptions.LineSize. |
SET LONG 80|<value> | Outputs up to a specified amount of characters for a character or BLOB value - ScriptOptions.MaxStringWidth. |
SET PAGESize 24|<value> | Sets the page length when printing a result set - ScriptOptions.PageSize. |
SET PARAMARRAY 1|<value> | Specifies the size of the parameter array - ScriptOptions.ParamArraySize, Params.ArraySize. |
SET SERVEROUTPUT OFF|(ON [SIZE <value>]) | Shows the server output after the command execution - ResourceOptions.ServerOutput, ServerOutputSize. |
SET (TERMout|CONsole) OFF|ON | Enables the output to the console, including the command result sets, parameter values, statuses, errors, etc - ScriptOptions.ConsoleOutput. |
SET TIMing OFF|ON | Outputs a command execution time - ScriptOptions.Timing. |
SET TRIMout OFF|ON | Trims spaces from strings at the console output - ScriptOptions.TrimConsole. |
SET TRIMSpool ON|OFF | Trims spaces from strings at the spool output - ScriptOptions.TrimSpool. |
SET VERify OFF|ON | Outputs the SQL command before execution with substituted macros - ScriptOptions.Verify. |
(SPOol | OUTput) [OFF|[APPend] <spool name>] | Without arguments--prints the spooling status.
OFF--turns off the spooling. <spool name>--turns on the spooling and redirects it to the specified item name in the SQLScripts collection or to a file name. |
UNDEFine <var1> [..., <varN>] | Undefines specified macros. |
VARiable [<name> (NUMber|CHAR|NCHAR [(<size>)]] [TABle <size>] [IN|OUT|INOUT] [=<value>] | without arguments--prints all the parameter values.
<name>--defines a parameter with specified data type, size and direction. = <value>--assigns a value to the parameter. |
CREATE DATABASE <db file name> [PAGE_SIZE <n>] [DEFAULT CHARACTER SET '<ch set>'] [USER '<user>'] [PASSWORD 'pwd'] | Used for Firebird and InterBase connections to create the database. |
DROP DATABASE | Used for Firebird and InterBase connections to drop the database. |