Replace Query

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • bipinskulkarni
    New Member
    • Dec 2007
    • 15

    Replace Query

    I have 4 records in my table having a field with bit datatype.

    I want to change the values of that in one replace statment
    without giving where condition.(valu e 0 by 1 and 1 by 0)

    Recd 1) 0
    2) 0
    3) 1
    4) 1
  • Jim Doherty
    Recognized Expert Contributor
    • Aug 2007
    • 897

    #2
    Originally posted by bipinskulkarni
    I have 4 records in my table having a field with bit datatype.

    I want to change the values of that in one replace statment
    without giving where condition.(valu e 0 by 1 and 1 by 0)

    Recd 1) 0
    2) 0
    3) 1
    4) 1
    use an SQL update

    update dbo.tblYourTabl eName
    set YourFieldName = case YourFieldName when 0 then 1 else 0 end

    Jim :)

    Comment

    Working...