Conversion Functions

The Historian OLE DB Provider generally returns data with the VARIANT data type. Some OLE DB clients may not understand VARIANT data, however, and will require the data to be returned as an integer, float, or string data type. To accommodate this, the OLE DB Provider includes the functions described in the following table.

Table 1. Conversion Functions
FunctionDescription
to_double (column)The to_double function converts the specified column to a double float data type.
to_integer (column)The to_integer function converts the specified column to a single integer data type.
to_string (column)The to_string function converts the specified column to a string data type.
Note:
  • You must edit the SQL statement manually to add conversion functions.
  • You can also use the fully qualified column name (for example, ihRawData.value).
  • Conversion functions are not available in WHERE or JOIN (ON) clauses.
  • Conversion functions cannot be used within aggregate functions. For more information, see SQL Aggregate Functions.

Example: Convert Values to Double Float

To convert a value to a double float, you would execute the following query:

select timestamp, to_double(value), quality from ihRawData