SET Variables
The following table outlines the supported SQL variables and settings that you can use
in a SET
statement. If you do not change any variables using the
SET
statement or a WHERE
clause in your
SELECT
statement, the default session variables are considered.
You can apply any of the variables described in the following table to the current
session. In turn, these settings are used when retrieving information from the
Historian database tables. SET
variables persist from statement to
statement.
SET
statement accept abbreviations. You must type at least the abbreviation for the
statement to work. For instance, for the CalculationMode
setting, you
can enter the abbreviation Interp for the
Interpolated
setting. The accepted abbreviations are highlighted in
bold in the following table.Variable | Description | Default Setting |
---|---|---|
StartTime |
A valid date and time string, such as:
|
Two hours prior to execution of the query. |
EndTime |
A valid date and time string, such as:
|
The current time that you execute the query. |
SamplingMode |
String that represents the mode of sampling data from the archive:
|
Calculated |
Direction |
String that represents the direction of data sampling from the
archive, beginning at the start time. Direction applies
to the RawByTime and RawByNumber
sampling modes:
|
Forward |
NumberOfSamples |
Any positive integer that represents the number of samples from the
archive to retrieve. Do not enter a thousands separator. For example,
enter 1000 and not
1,000. Samples are evenly spaced within the
time range defined by start and end times for most sampling modes.
For the |
0 (use IntervalMilliseconds ) |
IntervalMilliseconds |
Any positive integer that represents the interval (in milliseconds)
between returned samples. For example:
|
60000 (one minute) |
CalculationMode |
The CalculationMode column applies only if the
SamplingMode is set to Calculated .
It represents the type of calculation to perform on archive data:
|
Average |
FilterTag |
A valid tagname used to define the filter. For
example:
You can specify only a single
tag ID can be specified in the |
An empty space (meaning FilterTag is not
used) |
FilterMode |
String that represents the type of time filter:
For example, |
BeforeTime |
FilterComparisonMode |
String that represents the type of comparison to be made on the
filter comparison value:
FilterTag and
FilterComparisonValue in the SET
statement, time periods are filtered from the results where the filter
condition is False .
FilterComparisonMode is used in conjunction with
FilterValue , FilterMode , and
FilterTag . |
Equal |
FilterExpression |
An expression that includes multiple filter conditions. You can use
FilterExpression instead of
FilterTag , FilterComparisonMode ,
and FilterValue .
FilterExpression , the expression is passed within
single quotes, and for complex expressions we write the conditions
within parentheses. There is no maximum length for
FilterExpression . |
|
FilterValue |
String that represents the value with which to compare the filter tag
to determine the appropriate filter times. Wildcards are not supported.
Do not use a comma for the thousands separator. For example:
The
|
An empty space (meaning filtering is not used) |
TimeZone |
String that represents the type of time zone that should be applied
to timestamps:
For example, an explicit bias number of 300 represents 300 minutes from GMT. Note: Time zones are not supported on Windows 9x computers.
|
Client |
DaylightSavingTime |
Indicates whether Daylight Saving Time logic should be applied to
timestamps. Valid values:
|
Date and time settings in your Windows Control Panel |
RowCount |
A number that indicates the maximum number of rows that can be
returned. 0 indicates there is no limit to the number
of rows returned. |
5000 |