String formatter SQL query examples
Examples of SQL queries that parameterize columns, operators, and placeholders
for dynamic query construction.
Parameterize the name of the internal column with the condition:
SELECT * FROM Table1 WHERE {0:sql_identifier} > 5
Comparison with a data variable:
SELECT * FROM AlarmsDatalogger WHERE Time > {0:sql_literal}
Parameterize the
LIKE
operator:
SELECT * FROM AlarmsDatalogger WHERE Name LIKE '{0}'
Parameterize a part of a query with a placeholder:
SELECT * FROM Table1 {0}
The placeholder with index
0
is linked to a project string variable
and parameterizes a column; The placeholder with index 1
is linked
to a numeric variable that represents the value for the comparison operator
>
:
SELECT * FROM {0:sql_identifier} WHERE Column1 > {1:sql_literal}
Parameterize the table name, the column and also the
LIKE
operator:
SELECT {0:sql_identifier} FROM {1:sql_identifier} WHERE {0:sql_identifier} LIKE '{2}'
Provide Feedback