Why does the query:
SELECT CAST((column LIKE '%string%') AS INT)+100
return
Incorrect syntax near the keyword 'AS'
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With