标签: sql-server
当INT值为0且BIT值与0不同时,如果我将INT转换为INT会怎样?
INT
BIT
喜欢:
SELECT CAST (0 AS bit)
或
SELECT CAST (10 AS bit)
答案 0 :(得分:7)
只需尝试一下:
SELECT CAST (10 AS bit) AS a, CAST (0 AS bit) AS b
返回:
a | b ==+== 1 | 0
这意味着0保持不变,而所有其他整数值将转换为1.