Export (0) Print
Expand All
Expand Minimize

~ (Bitwise NOT) (SQL Server Compact)

Performs a bitwise logical NOT operation for one given integer value 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, a tinyint if the input values are tinyint, or a bit if the input values are bit.

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

CREATE TABLE bitwise (A int NOT NULL, B int NOT NULL)
INSERT bitwise VALUES (170, 75)
SELECT ~ A, ~ B FROM bitwise
--Returns -171 and -76
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft