Home
Syndication
Sign In
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.
Code
Monday, March 10, 2008 12:23:46 PM (Eastern Standard Time, UTC-05:00) by
Dustin
Comments [0]
|
« Confirmation Buttons in .NET
Comments and shouting »
All comments require the approval of the site owner before being displayed.
Name
E-mail
Home page
Remember Me
Comment (HTML not allowed)
Enter the code shown (prevents robots):
All content © 2008, Dustin Updyke
Search
On this page
Archives
Full Archives By Category
March, 2008 (4)
February, 2008 (3)
October, 2007 (1)
August, 2007 (1)
By The Minute