Use an unconventional tagname in a wide table query
- Last UpdatedMar 19, 2025
- 1 minute read
In a SQL query against a wide table, unconventional tag names must be delimited with brackets ( [ ] ), because the tagname is used as a column name. For example, tagnames containing a minus ( - ) or a forward slash ( / ) must be delimited, otherwise the parser will attempt to perform the corresponding arithmetic operation. No error will result from using brackets where not strictly necessary. For more information on unconventional tagnames, see Tag naming conventions.
The following is an example of how to delimit a tagname in a query on a wide table. "ReactTemp-2" and "ReactTemp+2" are tagnames. Without the delimiters, the parser would attempt to include the "-2" and "+2" suffixes on the tagnames as part of the arithmetic operation.
For clarity and maintainability of your queries, however, it is recommended that you do not use special characters in tagnames unless strictly necessary.
SELECT * FROM OpenQuery(INSQL,
'SELECT ReactTemp, [ReactTemp-2]-2, [ReactTemp+2]+2 FROM WideHistory WHERE ... ')