in c# i have a:
a = !a
(if false makes it true, if true makes it false)
in sql i want to do the same with a BIT variable
something like:
declare @a bit
set @a = 1
select @a
set @a = not (@a)
select @a
can i?
i could always do an IF, but this would “look better” 🙂
try this by using a bitwise not
The ~ bitwise operator performs a bitwise logical NOT for the expression, taking each bit in turn. If expression has a value of 0, the bits in the result set are set to 1; otherwise, the bit in the result is cleared to a value of 0. In other words, ones are changed to zeros and zeros are changed to ones.
make it 1