Export (0) Print
Expand All
Expand Minimize
1 out of 1 rated this helpful - Rate this topic

~ (Bitwise NOT) (SQL Server Compact Edition)

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 2005 Compact Edition 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
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.