Logical Operators

The Historian OLE DB Provider supports the use of these logic operators in SQL statements:

  • AND
  • OR
  • NOT

The following examples show possible uses of these operators in SELECT statements.

Example 1: Use the AND Logical Operator

SELECT * FROM ihTags WHERE Tagname LIKE 'Simulation*' AND CollectionInterval<3000

Example 2: Use the OR Logical Operator

SELECT * FROM ihTags WHERE Tagname LIKE 'ComputerName.Simulation*' OR tagname LIKE '*String*'

Example 3: Use the NOT Logical Operator

SELECT * FROM ihTags WHERE NOT Datatype=SingleFloat

Example 4: Use the NOT Logical Operator With a LIKE Expression

SELECT * FROM ihTags WHERE Tagname NOT LIKE '*String*'