0

BigQuery, MySQL, Spanner, and Sybase provide a bit_xor aggregate function, which can run a bitwise XOR operation on all 64-bit integers in a group (from a GROUP BY query).

How would I run an aggregate bitwise XOR in Microsoft SQL Server?

Tim Swast
  • 14,091
  • 4
  • 38
  • 61

1 Answers1

0

The ^ bitwise operator in SQL Server performs a bitwise logical exclusive OR between the two expressions, taking each corresponding bit for both expressions.

Example:

SELECT a_int_value ^ b_int_value  
FROM bitwise;  
GO 

For aggregate bitwise xor SQL Server does not have native support but you can create a function as below:

SQL Server : bitwise operation in Group By

Gabriele Franco
  • 879
  • 6
  • 10