鑑於這種T-SQL代碼在CASE「指定的非布爾類型的表達式」:WHEN
SELECT CASE
WHEN (Cast (CASE
WHEN Isnull(bpe.new, 0) = 0
AND Isnull(bpe.regular, 0) = 0
AND Isnull(bpe.bargain, 0) = 0 THEN 0
ELSE 1
END AS BIT)
AND @siteID IS NULL
OR bpe.siteid = @siteID) THEN 1
ELSE 0
END AS SiteHasBrandException
FROM brandpromoexceptions AS bpe
我得到的錯誤消息:
在指定的非布爾類型的表達式上下文中預期的條件TSQL
這是爲什麼?