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))
2.1m questions
2.1m answers
60 comments
57.0k users