If a MS SQL Table contains a bit
type column, and you try to query it using column_name = 1
then the query planner translates this to, WHERE [column_name]
. This is invalid syntax for MS SQL, so it throws the error:
An expression of non-boolean type specified in a context where a condition is expected
If I try use Dremi’s internal functions to cast it to integer, CAST(column_name AS int) = 1
I get the error:
Cast function cannot convert value of type BOOLEAN to type INTEGER
I found that as a workaround I can cast it to a string and get a valid comparison, CAST(column_name AS varchar(1)) = '1'
.