Flip bit column in SQL#
~ is the NOT operator in SQL, so for a bit column, to flip a value the statement would be something like this:

UPDATE dbo.Users SET Optin = ~Optin WHERE Id = @id

Just found this today and after using SQL for so many years, this will definitely come in handy going forward.

Monday, March 10, 2008 12:23:46 PM (Eastern Standard Time, UTC-05:00) by Dustin #    Comments [0]  | 

 

All comments require the approval of the site owner before being displayed.
Name
E-mail
Home page

Comment (HTML not allowed)  

Enter the code shown (prevents robots):

All content © 2008, Dustin Updyke


Search
On this page
Archives
By The Minute