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))
1.4m articles
1.4m replys
5 comments
57.0k users