how to check bit field value?

  • Hello,

    I have a table which contains a bit datatype field called CancelFlag.

    How can I check whether CancelFlag value is not true?

    Thanks & Regards.

  • Where CancelFlag = 0

    A bit holds values of 1 or 0. By convention, 0 is false and 1 is true, though there's nothing in SQL that enforces that.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • thanks .

    but the column contains True,False & NULL value and i want all rows which doesn't contain True value.

  • ankur (12/24/2008)


    but the column contains True,False & NULL value and i want all rows which doesn't contain True value.

    Where Coalesce(CancelFlag, 0) = 0

  • It works.

    Thank you very much.

  • The Stright forward statement is

    WHERE CancelFlag = 'False' or CancelFlag IS NULL

    The bit datatype allows you to compare the column with value 'True' or 'False'

    Venkat

Viewing 6 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply