Incode Systems Home Page Incode Systems, Inc.


SQLX



(Windows Program Win95 or higher)

- Copyright (C) Incode Systems, Inc. 2002-2010.

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 -db -U and -P are ignored)
-d ODBC Data Source Name
-db Database Name (override Database defined in DSN)
-df:m/d/yyyy Date format.
"-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)
-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), SQL parameters are in the form name=value,
where name is the parameter name in the SQL without type prefix
case insensitive. If -np-, parameters are matched by number.
-P password (if * user is prompted)
-parms: (following are tab delimited parameters for the SQL statement)
Note: This must be at end of command line. The parameters are separated
with tab characters (ASCII 9). An empty string is NULL, one or more
spaces is treated as an empty string. Do not double quote.
-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.
-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: "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.
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=may contain macros &DATE& and &TIME&.

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.7.0 http://www.incodesystems.com
mailto:sales1see complete usage, type: SQLx /? | MORE