How to check if bit variable is true or false in sql server?

Viewed 99025

I have a simple query and all I want to do is check if this variable is true or false, and for some reason it always returns false.

DECLARE @CappedIFCheck BIT
SET @CappedIFCheck = (SELECT distinct 1
                      FROM mytable
                      WHERE 1=1);

select @CappedIFCheck
     IF (@CappedIFCheck = 'True')
        BEGIN
           SELECT 'true';
        END
     ELSE
        BEGIN
           SELECT 'false';
        END
3 Answers
Related