Reverse Data With BIT TYPE for MS SQL

Posted by Milacay on Stack Overflow See other posts from Stack Overflow or by Milacay
Published on 2013-06-30T16:16:39Z Indexed on 2013/06/30 16:21 UTC
Read the original article Hit count: 134

Filed under:

I have a column using a BIT type (1/0). I have some records are set to 1 and some are set to 0. Those are record flag needs to be reversed. So basically, I want all records with 1 set 0, and all records with 0 set to 1.

If I run "Update Table1 Set Flag = 1 Where Flag = 0" first, then I am afraid all record flags will be 1 now, and will not able to know which ones are flag = 0.

any suggestions,
Thanks!

© Stack Overflow or respective owner

Related posts about sql-server