SQL Items

SQL item types consists of

The items are used to collect data from an SQL server using either select queries or invoking stored procedures. The items exposes objects in OPC UA namespace that contains methods for iterating over the data return from the queries.

The items exposes two methods in the OPC UA namespace

  • First
  • Next

The parameters of the First method is the max numbers of rows to return in each query, and the parameters as defined in either the stored procedure or the select query. The supported SQL data types and the corresponding mapping to the OPC UA datatypes is listed in the table below.

SQL datatypeUA built-in type ID
int6
datetime13
nvarchar12
float10
bigint8

OPC UA Datatypes

First will return the data as an matrix containing the result of the query. If the results exceeds the max number of rows argument, First will also return an continuation point id. The continuation point id can then be used an argument when calling Next, which will return the next batch of results.

Notes

  1. When theres a continuation point, the user should always resolve the rest of the data by calling Next methods until theres no more continuation points. This will ensure the connection is closed.