Incode Systems Home Page Incode Systems, Inc.


(Windows Program Win95 or higher)

SQLx - Copyright (C) Incode Systems, Inc. 2002-2012

Usage: [options] InFileName[.sql] OutFileName[.txt] LogFileName[.log]
If any FileName is not given, standard input and output are used.
If any FileName is CON, standard input and output are used.
If InFileName begins with "SQL:" it is used as a literal SQL statement.
Options: (case sensitive, may be preceeded with a - or /)
-? help (this screen)
-a Abort batch on error
-ao Append output file
-al Append log file
-cf: (char flag) Adds suffix to column heading of character columns
(example -cf:~2 adds ~2 for use with XLImport)
-cp Convert date and time type parameters (default)
(valid date and time formats are determined by Control Panel settings)
-cs Driver Connect String (if -cs is used -d -U and -P are ignored)
-d ODBC Data Source Name
-db Database Name (override Database in DSN or Connect String, use * to prompt)
-df:m/d/yyyy Date format.
-ds: overrides the control panel setting for the DataSeparator.
(must be a single character following the colon)
"-dtf:m/d/yyyy h:nn:ss" Date time format.
-e Echo SQL to output
-fd Format decimal numbers (leading 0, remove trailing zeros and decimal point)
-h Header row (default)
-help (this screen)
-ipt (ignore parameter type prefix)
-lt Log timestamp (default)
-ltf:h:nn:ss overrides the control panel setting for the long time format
used as the default time format for input and output.
-md:filename writes metadata for result set to filename
-np Named Parameters (default). In SQL code prefix name with a colon (:).
-P password (if * user is prompted)
-parms:Parm1=Value Note: This must be at end of command line. Parameters are in the form:
Name=Value if named parameter are used, -np (default), and name/value pairs
are separated by tab characters (ASCII 9). Empty string = NULL,
one or more spaces is an empty string.
Do not include parameter type prefix or surround values with quotes.
If -np- option is used, use ? in SQL, -parms:Value These type prefixes may be used for compatibility with other programs,
but are ignored by SQLx; parameter types are queried from the SQL server:
bo=boolean, dt=date, ts=timestamp, fl=float, in=int, si=smallint, st=string
tm=time, wd=word. (example: SELECT * FROM Table WHERE Col=:inColValue)
If the SQL server does not return parameter type information, SQLx defaults
to a character type, which may produce an error. Use CAST to handle this.
Example: SELECT * FROM Table WHERE Col=CAST(:inColValue AS int)
-pp (prompt for missing SQL statement parameters)
-qall Quiet all messages sent to console.
-qecho Quiet echo metacommands (--$ECHO).
-qerror Quiet error server messages displayed to console.
-qinfo Quiet info server messages sent to console.
-qstat Quiet status SQLx messages normally sent to console.
-Q "command line query" (or prefix InFileName "SQL:")
-sdf:m/d/yyyy overrides the control panel setting for the short date format
used as the default date format for input and output.
-t Right trim blanks from data (default)
"-tf:h:nn:ss am/pm" Time format.
-ts: overrides the control panel setting for the TimeSeparator.
(must be a single character following the colon)
-U Login (if * user is prompted)
-v Verbose mode, write SQL_SUCCESS_WITH_INFO messages to the log
Command line parameters containing spaces should be surrounded by double quotes.
A minus sign after the option turns it off (example: -h- for No Header row).
Program directory, then current directory is checked for SQLx.ini
which is a text file in the form: Option=OptionValue example: d=Data Source Name
An initialization file may specified on the command line like this: (the "indicates it is an initialization file, the file name is MyFile.ini)
Options in these files are evaluated in order, overriding previous files.
Login and password optional if DBMS supports trusted connections.
Statements in a batch are separated with "GO" or "--$GO" on a line by itself.

Date and Time formatting strings:
Use blank format for no formatting, use _ for default formatting
DateTime default format leaves off time if time is zero.
/ is replaced with the DateSeparator from Control Panel.
: is replaced with the TimeSeparator from Control Panel.
Anything surrounded by single quotes is used as is, ex: m'/'d'/'yyyy
d for day (1), dd for (01), ddd for ShortDay, dddd for LongDay.
Examples: mm/dd/yy for 01/01/09, m/d/yy for 1/1/09, mm-ddd-yy for 01-Thu-09.
ddddd for ShortDateFormat, dddddd for LongDateFormat from Control Panel.
m for month 1, mm for 01, mmm for ShortMonth, mmmm for LongMonth.
Note: Day and Month names are in the language configured in the Control Panel.
yy for 2 digit year, yyyy for 4 digit year.
a/p displays a or p for time with matching capitalization.
am/pm displays am or pm for time with matching capitalization.
ampm uses time am/pm strings from Control Panel.

Metacommands start in column 1 of a line in InFile:
--$(any option as it would be represented in a file)
--$ECHO Echos this to standard output
--$ECHOLOG This echos the current &DATE& and &TIME& to the log file
--$InFileName=--$OutFileName=--$LogFileName=--$AppendOutFileName=--$AppendLogFileName=Metacommands may contain macros: &DATE&, &TIME&, &INFILE&, &OUTFILE&, &LOGFILE&,
&INFILE1&, &OUTFILE1&, &LOGFILE1& (the original names from command line).
Metacommands may contain environment strings in the form: %VAR%

ERRORLEVEL is 0 if processing completed without error.
ERRORLEVEL is 1 if one or more SQL statements errored.
ERRORLEVEL is 2 if SQL login failed.
ERRORLEVEL is 3 if an I/O error.
ERRORLEVEL is 100 if SQLx failed to start.

Version 1.11.0
mailto:sales1To see complete usage, type: SQLx /? | MORE