You can switch the bit field’s value with single update statement by using exclusive or operator.
UPDATE AdminUsers
SET IsActive = IsActive ^ 1
WHERE Id = 42
Happy codding…
Referance: ^ (Bitwise Exclusive OR) (Transact-SQL)
You can switch the bit field’s value with single update statement by using exclusive or operator.
UPDATE AdminUsers
SET IsActive = IsActive ^ 1
WHERE Id = 42
Happy codding…
Referance: ^ (Bitwise Exclusive OR) (Transact-SQL)
Begin typing your search term above and press enter to search. Press ESC to cancel.