为什么查询:
SELECT CAST((column LIKE '%string%') AS INT)+100
返回
Incorrect syntax near the keyword 'AS'
最佳答案
因为 bool 不是 T-SQL 中的类型。它不存在。 boolean 表达式不是位类型。它们没有类型 - 只有在特殊地方的语法允许时才允许它们。是的,这太可怕了。
SELECT (case when (column LIKE '%string%') then 1 else 0 end)+100
关于sql-server - SQL Server : Cast bool as integer,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15056542/