WHERE clause anomalies
- Last UpdatedMar 19, 2025
- 1 minute read
In some rare cases, the SQL Server query processor truncates the WHERE clause in an attempt to optimize the query. If you execute a query with a WHERE clause, but an error message is returned stating that no WHERE clause was received by the SQL Server, simply add another condition clause to the query.
For example, in the following query, the SQL Server query processor optimizes out the WHERE clause, because it is superfluous.
SELECT DateTime, Value, QualityDetail
FROM History
WHERE TagName LIKE '%'
A workaround is to add another condition clause. For example:
SELECT DateTime, Value, QualityDetail
FROM History
WHERE TagName LIKE '%'
AND wwRetrievalMode = 'delta'