Is there an XOR operator or equivalent function in SQL Server (T-SQL)?
There is a bitwise XOR operator - the caret (^), i.e. for:
SELECT 170 ^ 75
The result is 225.
For logical XOR, use the ANY keyword and NOT ALL, i.e.
WHERE 5 > ANY (SELECT foo) AND NOT (5 > ALL (SELECT foo))
548k questions
547k answers
4 comments
86.3k users