|
|
Question : Unary and bitwise operators
|
|
Hi all,
the SQL book says following:
"Unary Performs an operation on only one expression of any of the data types of the numeric data type category Bitwise Temporarily turns a regular numeric value (such as 150) into an integer and performs bitwise (0 and 1) arithmetic"
Can someone please give me a two simple examples of unary and bitwise operators that can be used in SQL Server?
cheers,
henrik
|
Answer : Unary and bitwise operators
|
|
bitwise NOT select ~(254) -- === -255 A bitwise unary operator (only takes one argument)
select sqrt(81) A unary operator (only takes one argument) (nothing to do with the binary value)
Bitwise OR select 8 | 5 === 13 A binary operator (takes two arguments ... left and right )
Multiplication select 123 * 456 --- == 56088 Anothor binary operator (nothing to do with bitwise operations)
---
Unary - takes one argument Binary - takes two arguments
|
|
|
|