SELECT.SQL

Selects content from a database via SQL-script.

Properties

From

Must contain (or reference) a connection string, in one of the following ways:

  • Name of a Data Source
    This data source must contain a connection string. This can be defined using the SET command.

  • Complete Connection string
    Provider=SQLOLEDB;server=localhost;UID=perfion;PWD=mypw;DATABASE=NAV2018

  • Lookup from a named Connection defined in Perfion
    Go to Administration -> Remote Connections to see defined connections
    @REMOTECONNECTIONNAME=Dynamics NAV 2018 Production

  • Reference to current Perfion database
    Just type a '.' (period) in the From field

To

Name of the Output Data Source.
The output-source will always be a neutral Table-format.

Script

The SQL script code used to query the database.

The script-code can also be defined dynamically by including parameter references. The parameter values are evaluated in the same way as the script method { 9.16 Method: FillTemplate ( … ) }.
Example 1:
SELECT * FROM Customers WHERE Name='{=$CustomerName}'
Example 2:
If you want to create the entire script dynamically simple just include a reference to the parameter containing the script such as:
{=$MyScript}

Parameters

@CommandTimeOut

If unspecified the default value is 30 secs.
Recommendation: Do not set this value unless you really need to.

Setting this value to e.g. 10 does not mean that the query will time out after 10 secs if it is not completed. It may actually run for much longer. Only if the client has not received any feedback within the timeout period will it time-out.
For example, if the query simply returns a large result-set (that takes long to transfer) it will often be transferred in blocks, and as long as the query detects as being alive it will continue running without timing out.
This means that queries that time out will most likely be due to long response times from finding the desired data, e.g. due to complex criteria, or missing indexes on large amounts of data.

@Filter

Filter the result of the selected data. See Command Maps & Parameters for more information.

@Order

Order the result of the selected data. See Command Maps & Parameters for more information.

Map

This Command does not use any value mappings.