Supported SET Statement Syntax

The use of SET statements is not mandatory because you can also specify query parameters in a WHERE clause. However, SET statements can make your queries more readable. By using SET statements, you can save time by simplifying SELECT queries, because you do not have to retype query parameters each time you issue a new SELECT statement. The SET parameters persist for the entire session.

With a SET statement, you can define various defaults for your queries to use, such as:

  • The start date and time of the selected data
  • The end date and time
  • The calculation mode
  • The number of rows returned
  • The data sampling mode

For more information, refer to ihQuerySettings Table.

When entering numbers, do not use a thousands separator. For example, if you want to set a collection interval to 7,000 milliseconds, use the following code:
SET IntervalMilliseconds = 7000

Correct SET Without Comma to Separate Thousands Place

Multiple SET statements in the same command are not supported. Combine multiple variables in the same SET statement.

Correct:
SET starttime=yesterday-10d, endtime=today, samplingmode=interpolated
Incorrect:
SET starttime=yesterday-10d
SET endtime=today
SET samplingmode=interpolated