error while comparing a bit value in sql

  • Hi,

    I have declared one variable as bit, and it get set to value 1/0 by query. When I am trying to check this value as 'if @variale==1' it gives error.Any help will be appreciated.

  • Hi.

    try

    IF @variable = 1.

    (one "=")

  • I tried @variable0 and it is working fine

  • kavita_pansare (5/26/2009)


    When I am trying to check this value as 'if @variale==1' it gives error.

    SQL only uses one = for comparison.

    If that's not it, tell us what the error message is.

    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
  • It looks like a problem I had before in a Delphi application.

    I solved it by casting to int and comparing to1 (integer value).

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

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