SQL Server: Cast bool as integer
boolean, integer, sql-server, type-conversion
Solution
Because bool is not a type in T-SQL. It does not exist. Boolean expressions are not of type bit. They don't have a type - they are only allowed if allowed by the grammar in special places. And yes, this is awful.
SELECT (case when (column LIKE '%string%') then 1 else 0 end)+100
Problem
Why does the query: ``` SELECT CAST((column LIKE '%string%') AS INT)+100 ``` return Incorrect syntax near the keyword 'AS'