Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
^ (Bitwise Exclusive OR) (SQL Server Compact)
Collapse the table of content
Expand the table of content

^ (Bitwise Exclusive OR) (SQL Server Compact)

Performs a bitwise exclusive OR operation between two given integer values as translated to binary expressions within SQL statements.

expression ^ expression


Any valid expression in Microsoft SQL Server Compact 3.5 of any of the data types of the integer data type category, or of the binary or varbinary data type. The expression is an integer that is treated and transformed into a binary number for the bitwise operation.

Returns an int if the input values are int, a smallint if the input values are smallint, or a tinyint if the input values are tinyint.

The following example performs the bitwise exclusive OR operation between two integer columns.

INSERT bitwise VALUES (170, 75)
SELECT A ^ B FROM bitwise
--Returns 225

The binary representation of 170 (A) is 0000 0000 1010 1010. The binary representation of 75 (B) is 0000 0000 0100 1011. Performing the bitwise exclusive OR operation on these two values produces the binary result 0000 0000 1110 0001, which is decimal 225.

(A ^ B)   
         0000 0000 1010 1010
         0000 0000 0100 1011
         0000 0000 1110 0001
© 2015 Microsoft