In MySQL, Oracle and PostgreSQL an expresion like
1 = 1 can be used in where like:
where 1 = 1 as well as
where (1 = 1) is not null
In MSSQL, it seem that:
- a) when an expression is a predicate, it can not be further compared as an expression
- b) where requires predicate
The question is – is it possible to wrap an expression like EXPR =
1 = 1 to be accepted into
where EXPR as well as into
where EXPR is not null for MSSQL?
let EXPR string to be
1 = 1(but can be
[name] = 1where name is a column, like any valid SQL expression)
wrap EXPR here with some extra text from left or right side
both of these queries must work:
SELECT (EXPR), ie.
SELECT (1 = 1)
SELECT (EXPR) = 1, ie.
SELECT (1 = 1) = 1
The original EXPR or the usage can not be modifed as hardcoded. The only possibility to modify the expression is to wrap it like
convert(bit, EXPR) (but this does not work).