How to return a boolean value on SQL Select Statement?
I tried this code:
SELECT CAST(1 AS BIT) AS Expr1 FROM [User] WHERE (UserID = 20070022)
Given that commonly 1 = true and 0 = false, all you need to do is count the number of rows, and cast to a boolean.
1 = true
0 = false
boolean
Hence, your posted code only needs a COUNT() function added:
COUNT()
SELECT CAST(COUNT(1) AS BIT) AS Expr1 FROM [User] WHERE (UserID = 20070022)