Back to

Running the query

Running QUERY from the command line

QUERY can be used from command prompt in two ways.

NOTE: You must enclose the name of the QUERY executable and the full path in double quotation marks. In addition, ensure that there is a single space between the QUERY executable path and the query file path.

For Open (program screens appear)

"C:\Program Files\Winshuttle\query\querySHUTTLE.exe" ‑opn"C:\ Test\Testquery.qsq"

-rfn"C:\ Test\Testquery.xls" -rdt"Sheet1" -nrc"1000" -srw"10" -alf" C\Test\Testquery.alf"

For Run (program screens appear)

"C:\Program Files\Winshuttle\query\query.exe" -run"C:\ Test\Testquery.qsq" -rfn"C:\ Test\Testquery.xls" -rdt"Sheet1" -nrc"1000" -srw"10" -alf" C\Test\Testquery.alf"

As a console application

"C:\Program Files\Winshuttle\query\querySHUTTLEcom.exe" -run"C:\ Test\Testquery.qsq" -rfn"C:\ Test\Testquery.xls" -rdt"Sheet1" -nrc"1000" -srw"10" -alf" C\Test\Testquery.alf"

QUERY commands

All commands that run at the command prompt take precedence over the same commands that are already contained in the query file. QUERY overwrites the existing query file commands in memory with the commands passed from the command line.

NOTE: It is recommended that you first test these commands in a nonproduction system with a limited number of transactions before deploying the query script.

Token

Description

Example

-opn

Open

-opn"C:\ Test\Testquery.qsq"

This token can only be used with queryShuttle.exe

-run

Run

-run"C:\ Test\Testquery.qsq"

-rfn

ResultFileName

-rfn"C:\ Test\Testquery.xls"

-rdt

Result destination for Excel sheet name; table name for Access and SQL Server. (version 10.6 only)

-rdt"Sheet1"

-srw

Start row - in case of excel only

-srw"10"

-rtv

Run-time variables

-rtv"Tablename.Fieldname#variablename#'variablevalue'"

-eml

E-mail Addresses

-eml"1@test.com, 2@test.com"

-arf

Attaching result file with mail

-arf

-nrc

Number of records to be extracted

-nrc"1000"

-alf

ALF File Path/Connection String

-alf"C:\Test\TestALF.alf"

-slf

Specify SQL logon file (slf) in case query mapped to SQL result destination. (version 10.6 only)

-slf"c:\ Test\Testquery.slf"

-spw

For suppressing production server warning

-spw

-log

Log column

-log"F"

Not applicable for XML and TEXT destinations.

For Open (program screen appears)

"C:\Program Files\Winshuttle\query\querySHUTTLE.exe" -opn"C:\ Test\Testquery.qsq" -rfn"C:\ Test\Testquery.xls" -rdt"Sheet1" -nrc"1000" -srw"10" -alf" C\Test\Testquery.alf"

For Run (program screen appears)

"C:\Program Files\Winshuttle\query\ querySHUTTLE.exe " -run"C:\ Test\Testquery.qsq" -rfn"C:\ Test\Testquery.xls" -rdt"Sheet1" -nrc"1000" -srw"10" -alf" C\Test\Testquery.alf"

For Run (As a console application)

"C:\Program Files\Winshuttle\query\querySHUTTLEcom.exe" -run"C:\ Test\Testquery.qsq" -rfn"C:\ Test\Testquery.xls" -rdt"Sheet1" -nrc"1000" -srw"10" -alf" C\Test\Testquery.alf"

For SQL Result Destination (version 10.6 only)  

In case of SQL destination, the SQL Logon details need to specified in the form of a SQL Logon File i.e. SLF , which can be Saved by entering correct SQL Logon details (Windows / SQL authentication) when saving a table to SQL Server.

-slf "c:\ Test\Testquery.slf"

For Attaching Result File in e-mail message (Not for SQL Result Destination)

-arf

For Suppressing Production Server Warning

-spw

Run-time variables

If you added run-time variables to your query, you can call them when you run the query from the command prompt. Variables take the following form:

‑rtv"TableName.FieldName#Value1#Value2|Value3#Value4|Value5|Value6"

# The hash symbol is used for separation between run-time variables values.   Values should be in same sequence as they are defined in Query Where Clause Builder screen.

~ The Tilde symbol is used for separation between run-time variables.

| The pipe symbol is used to separate variable values in which between and in are used.

Parameter Format is as follows:

"TableName.FieldName#Value1#Value2|Value3#Value4|Value5|Value6~TableName.FieldName#Value1#Value2"

(For example, the first field name has four run-time variables in which between and in variable values are separated by the pipe |. The hash symbol # is used for separation between run-time variables value.)

Here is the example of file variables.

For txt file:

"TableName.FieldName#Value1#Value2|Value3#c:\testvalue.txt~TableName.FieldName#Value1#Value2"

For Excel file:

"TableName.FieldName#Value1#Value2|Value3#c:\testvalue.xlsx*Sheet name*Column name*Start row*End Row~TableName.FieldName#Value1#Value2"

Note:

If End Row will be given as 0 then the last value considered will be one having 5 empty rows after it.

Tilde (~) example:

If more than one run-time fields are present in the query, they should be separated by a "~".

"TableName.FieldName#Value1#Value2|Value3#Value4|Value5|Value6~TableName.FieldName#Value1#Value2"

Note:

Also in this section

Running

Publishing macros in an Excel workbook

Using the add-in for Excel

Using saved queries

Advanced run options