Is there an XOR operator or equivalent function in SQL Server (T-SQL)?
How about this?
(A=1 OR B=1 OR C=1)
AND NOT (A=1 AND B=1 AND C=1)
And if A, B and C can have null values you would need the following:
(A=1 OR B=1 OR C=1)
AND NOT ( (A=1 AND A is not null) AND (B=1 AND B is not null) AND (C=1 AND C is not null) )
This is scalable to larger number of fields and hence more applicable.
From your comment:
Example: WHERE (Note is null) ^ (ID is null)
you could probably try:
where
(case when Note is null then 1 else 0 end)
<>(case when ID is null then 1 else 0 end)
As clarified in your comment, Spacemoses, you stated an example: WHERE (Note is null) ^ (ID is null). I do not see why you chose to accept any answer given here as answering that. If i needed an xor for that, i think i'd have to use the AND/OR equivalent logic:
WHERE (Note is null and ID is not null) OR (Note is not null and ID is null)
That is equivalent to:
WHERE (Note is null) XOR (ID is null)
when 'XOR' is not available.