Saturday, February 25, 2012

about SQL update

Hi i have a problem recently about updating. Let's say i have table

TableName

Name TestBoolean

Ian 1

Shane 1

Ianne 0

Jong 0

How can i update the testboolean where the 1 must be 0 and 0 must be 1... in one statement only

Regards

update tablename set Testboolean = case when Testboolean = 0 then 1 else 0 end

Good luck

No comments:

Post a Comment