Not directly. You must use CASE, CAST means that it is interpreted as boolean by client code
SELECT
CAST(CASE WHEN expiry < getdate() THEN 1 ELSE 0 END AS bit) AS Expired
FROM
MyTable WHERE (ID = 1)
Another solution where one or zero rows are expected:
SELECT
CAST(COUNT(*) AS bit) AS Expired
FROM
MyTable
WHERE
ID = 1 AND expiry < getdate()
source
share