Back to

Running the query

Running Query from the command line (version 10.7)

Syntax

To run a Query script from the command line, use the following syntax:

"<Path>querySHUTTLEcom.exe" -run"<Central site>/QueryFiles/<script file name>" -rfn"<Result file path><result file name>" -alf"<Local ALF path><ALF file name>"

Note: Ensure that there is a single space between the Query executable path and the Central script file path.

Example

"C:\Program Files (x86)\Winshuttle\QUERY\querySHUTTLEcom.exe" -run"http://ws8-sp10-64:28116/sites/10.7FCS/QueryFiles/10.6 site.qsq" -rfn"C:\Users\vmahajan\Desktop\QUERY script - 7_10.xlsx" -alf"C:\Users\vmahajan\Documents\Winshuttle\Query\Alf\W6R800.alf"

Mandatory parameters

Using Query script 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.

Important: Be sure to test these commands in a nonproduction system with a limited number of transactions before you deploy the Query script.

Token

Description

Example

-run

Run

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

-rfn

ResultFileName

-rfn"<Central site>\Test\Testquery.xls"

-rdt

Result destination for Excel sheet name; table name for Access and SQL Server. (See the notes for version 10.7 below.)

-rdt"Sheet1"

-srw

Start row - in case of Excel only

-srw"10"

-rtv

Run-time variables

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

-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"

-spw

For suppressing production server warning

-spw

-log

Log column

-log"F"

Not applicable for XML and TEXT destinations.


For SQL Result Destination  

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"

Notes for 10.7:
Server must be configured on the Central site.
A SQL Server-mapped script cannot be run by using querySHUTTLEcom.exe. Instead, use querySHUTTLE.exe.

For attaching the result file in an email message

-arf

For suppressing the 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"

For linked files, variables take the following form:

‑rtv"<AbsoluteFilepath>~~<TableName.FieldName#Value1#Value2|Value3#Value4>"

# 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.

~~ Two Tilde symbols are used to separate the linked query script files.

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

Here is the parameter format:

"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 are examples of file variables.

For a .txt file:

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

For an 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"

Notes:

Also in this section

Running

Using the QUERY Add-In for Microsoft Excel

Using saved queries

Advanced run options