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)
I do it like this:
SELECT 1 FROM [dbo].[User] WHERE UserID = 20070022
Seeing as a boolean can never be null (at least in .NET), it should default to false or you can set it to that yourself if it's defaulting true. However 1 = true, so null = false, and no extra syntax.
Note: I use Dapper as my micro orm, I'd imagine ADO should work the same.