Friday, March 23, 2012

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.(value 0 by 1 and 1 by 0)

Recd 1) 0
2) 0
3) 1
4) 1

Quote:

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.(value 0 by 1 and 1 by 0)

Recd 1) 0
2) 0
3) 1
4) 1



use an SQL update

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

Jim :)sql

No comments:

Post a Comment