Configure the Stream Initialization Query properties
- Last UpdatedFeb 24, 2025
- 2 minute read
Configure the initialization of the streams for the tags that you configured. This is to get the initial value and time into the system and it is generally only executed once.
The StreamInitializationQuery is similar to the DataQuery, except that it returns only the first Sample. It is essentially the starting sample the first time you process a stream when it is uninitialized.
The StreamInitializationQuery accepts only parameters with ParameterValueType = TagName. You can limit the number of returned rows with the use of top(1) or a similar constraint. For example:
select top(1) Value, Quality, DateTime from ConnectorTable where Variable = '@TagName
When the query is called the tag name is replaced by the Address property for each variable. For example:
select top(1) Value, Quality, DateTime from ConnectorTable where Variable = 'Pump1'
Stored Proc: usp_GetInitialSample @TagName
To configure the Stream Initialization Query properties
-
Under the StreamInitializationQuery category, configure each of the listed properties. For more information on these properties, see Stream Initialization Query properties details.

This query returns a value and timestamp for each integration variable. Alternatively, you can invoke a stored procedure, which takes the name of the variable, and has IF statements to return a default value and time.
Note: The stream initialization query is invoked for every integration variable that you create.
-
Construct a query that represents the value to insert into the stream when it initializes from an inactive and empty state.
Example:
select Value, Quality, DateTime from ConnectorTable where Variable = @TagName
-
Specify the stream initialization query command type as Text or StoredProcedure.
-
Define the parameters in the stream initialization query using the Collection Editor.
Specify Stream Initialization Query parameters. In most cases, you create one for the Tag Name.

Configure each of the required parameter properties. For more information on the parameter properties, see Stream Initialization Query parameter properties.
-