I'm trying to perform a bitwise NOT in SQL Server. I'd like to do something like this:
update foo set Sync = NOT @IsNew
Note: I started writing this and found out the answer to my own question before I finished. I still wanted to share with the community, since this piece of documentation was lacking on MSDN (until I added it to the Community Content there, too).
Yes, the ~ operator will work.
update foo set Sync = ~@IsNew
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With