SQL queries
    Use the ANSI SQL-92 standard for querying ODBC databases and embedded databases.
Statements
      FactoryTalk Optix Studio
 supports these statements in SQL queries:
        - SELECT
 - DELETETIP: Run aDELETEquery to delete a record. You can perform all other operations by using the OPC UA methods exposed by the same objects. For more information on the SQL statements and clauses, see the SQL standard.
 - UPDATE
 
FactoryTalk Optix Studio
 partially supports these statements in SQL queries:
        - CREATE
 - DROP
 
Literal values
      
  Literal value type  | Example  | Notes  | 
|---|---|---|
Integral  | 1520  | Do not use any thousands separators. Use the Int32 type.  | 
Real  | 15.025  | Use  .  as the decimal separator.Use the Double type.  | 
Real scientific  | 2.7000001072883606E-1  | |
Boolean  | 
  | Use lowercase for Boolean values.  | 
String  | 'string value'  | Use single quotes to delimit text. Insert a single quote ( ' ) in a text string by escaping the single quote with another single quote. For example, to write 'string' , use two single quotes ''string''  in the strings. | 
Date and time  | "2004-05-23T14:25:10.487"  | Use the ISO8601 format delimited by double quotes. The date and time notation is non-standard ANSI SQL used to avoid the DATE , TIME , and TIMESTAMP  keywords without ambiguity. | 
Regular identifier  | 
  | Do not use spaces. Start with an uppercase or a lowercase letter. You can use numeric digits, letters, and the underscore character  _ . | 
Delimited identifier  | 
  | Use double quotes ( " ) as the delimiter.In the identifier, use any character except for the  "  character.Any spaces at the end of the identifier are ignored.  | 
Aliases
      You can use aliases in the identifiers, derived column subqueries, and tables.
The following are examples of queries with aliases:
        
SELECT Timestamp AS T FROM Table1 WHERE ...
SELECT * FROM Table1 AS T WHERE ...
SELECT * FROM (SELECT * FROM Table1) AS SubQuery WHERE ...
CREATE TABLE Table1 AS SELECT Timestamp, Column1 FROM Table2
Operators
      
  Operator  | Example  | 
|---|---|
IN  | 
  | 
BETWEEN  | 
  | 
LIKE  | 
 
 
  | 
EXISTS  | 
  | 
IS  | 
  | 
NOT  | 
 
 
 The  NOT  operator applies to all other operators. | 
Window functions
      
  Function  | Example  | 
|---|---|
ROW_NUMBER  | 
 
 
  | 
RANK  | 
  | 
DENSE_RANK  | 
  | 
AVG  | 
  | 
SUM , MIN , MAX  | 
  | 
COUNT  | 
 
  | 
Provide Feedback