I have a bitmasked int field in my database. Usually I manage it through C# code, but now I need to flip a bit in the mask using T-SQL
How do I accomplish the follow
TSql Bitwise operators can be found here and good article on how to use them is here
Use XOR:
SELECT value ^ 256
So in your case, SELECT 143 ^ 256 will indeed return 399. If you want to pass in the exponent as well:
SELECT 143 ^ 256
SELECT value ^ POWER(2, power)