Lokasi ngalangkungan proxy:   [ UP ]  
[Ngawartoskeun bug]   [Panyetelan cookie]                
Skip to content

Commit fba55ef

Browse files
authored
bitwise, corrected example
1 parent 7231f7e commit fba55ef

1 file changed

Lines changed: 37 additions & 37 deletions

File tree

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: "Bitwise Operators (Transact-SQL) | Microsoft Docs"
33
ms.custom: ""
4-
ms.date: "01/10/2017"
4+
ms.date: "09/07/2017"
55
ms.prod: "sql-non-specified"
66
ms.reviewer: ""
77
ms.suite: ""
@@ -24,40 +24,40 @@ manager: "jhubbard"
2424
# Bitwise Operators (Transact-SQL)
2525
[!INCLUDE[tsql-appliesto-ss2008-all_md](../../includes/tsql-appliesto-ss2008-all-md.md)]
2626

27-
Bitwise operators perform bit manipulations between two expressions of any of the data types of the integer data type category.
28-
Bitwise operators convert two integer values to binary bits, perform the AND, OR, or NOT operation on each bit, producing a result. Then converts the result to an integer.
29-
30-
For example, the integer 170 converts to binary 1010 1010.
31-
The integer 75 converts to binary 0100 1011.
32-
33-
|operator|bitwise math|
34-
|---- |---- |
35-
|AND <br> If bits at any location are both 1, the result is 1. |1010 1010 = 170 <br>0100 1011 = 75 <br>---------------- <br> 0000 1010 = 10 |
36-
|OR <br> If either bit at any location is 1, the result is 1. |1010 1010 = 170 <br>0100 1011 = 75 <br>---------------- <br> 1110 1011 = 2795|
37-
|NOT <br> Reverses the bit value at every bit location. |1010 1010 = 170 <br>---------------- <br> 0101 0101 = 85 |
38-
39-
See the following topics:
40-
* [& (Bitwise AND)](../../t-sql/language-elements/bitwise-and-transact-sql.md)
41-
* [&= (Bitwise AND EQUALS)](../../t-sql/language-elements/bitwise-and-equals-transact-sql.md)
42-
* [&#124; (Bitwise OR)](../../t-sql/language-elements/bitwise-or-transact-sql.md)
43-
* [&#124;= (Bitwise OR EQUALS)](../../t-sql/language-elements/bitwise-or-equals-transact-sql.md)
44-
* [^ (Bitwise Exclusive OR)](../../t-sql/language-elements/bitwise-exclusive-or-transact-sql.md)
45-
* [^= (Bitwise Exclusive OR EQUALS)](../../t-sql/language-elements/bitwise-exclusive-or-equals-transact-sql.md)
46-
* [~ (Bitwise NOT)](../../t-sql/language-elements/bitwise-not-transact-sql.md)
47-
48-
The operands for bitwise operators can be any one of the data types of the integer or binary string data type categories (except for the **image** data type), except that both operands cannot be any one of the data types of the binary string data type category. The following table shows the supported operand data types.
49-
50-
|Left operand|Right operand|
51-
|------------------|-------------------|
52-
|[binary](../../t-sql/data-types/binary-and-varbinary-transact-sql.md)|**int**, **smallint**, or **tinyint**|
53-
|[bit](../../t-sql/data-types/bit-transact-sql.md)|**int**, **smallint**, **tinyint**, or **bit**|
54-
|[int](../../t-sql/data-types/int-bigint-smallint-and-tinyint-transact-sql.md)|**int**, **smallint**, **tinyint**, **binary**, or **varbinary**|
55-
|[smallint](../../t-sql/data-types/int-bigint-smallint-and-tinyint-transact-sql.md)|**int**, **smallint**, **tinyint**, **binary**, or **varbinary**|
56-
|[tinyint](../../t-sql/data-types/int-bigint-smallint-and-tinyint-transact-sql.md)|**int**, **smallint**, **tinyint**, **binary**, or **varbinary**|
57-
|[varbinary](../../t-sql/data-types/binary-and-varbinary-transact-sql.md)|**int**, **smallint**, or **tinyint**|
58-
59-
## See Also
60-
[Operators &#40;Transact-SQL&#41;](../../t-sql/language-elements/operators-transact-sql.md)
61-
[Data Types &#40;Transact-SQL&#41;](../../t-sql/data-types/data-types-transact-sql.md)
62-
27+
Bitwise operators perform bit manipulations between two expressions of any of the data types of the integer data type category.
28+
Bitwise operators convert two integer values to binary bits, perform the AND, OR, or NOT operation on each bit, producing a result. Then converts the result to an integer.
29+
30+
For example, the integer 170 converts to binary 1010 1010.
31+
The integer 75 converts to binary 0100 1011.
32+
33+
|operator|bitwise math|
34+
|---- |---- |
35+
|AND <br> If bits at any location are both 1, the result is 1. |1010 1010 = 170 <br>0100 1011 = 75 <br>---------------- <br> 0000 1010 = 10 |
36+
|OR <br> If either bit at any location is 1, the result is 1. |1010 1010 = 170 <br>0100 1011 = 75 <br>---------------- <br> 1110 1011 = 235|
37+
|NOT <br> Reverses the bit value at every bit location. |1010 1010 = 170 <br>---------------- <br> 0101 0101 = 85 |
38+
39+
See the following topics:
40+
* [& (Bitwise AND)](../../t-sql/language-elements/bitwise-and-transact-sql.md)
41+
* [&= (Bitwise AND EQUALS)](../../t-sql/language-elements/bitwise-and-equals-transact-sql.md)
42+
* [&#124; (Bitwise OR)](../../t-sql/language-elements/bitwise-or-transact-sql.md)
43+
* [&#124;= (Bitwise OR EQUALS)](../../t-sql/language-elements/bitwise-or-equals-transact-sql.md)
44+
* [^ (Bitwise Exclusive OR)](../../t-sql/language-elements/bitwise-exclusive-or-transact-sql.md)
45+
* [^= (Bitwise Exclusive OR EQUALS)](../../t-sql/language-elements/bitwise-exclusive-or-equals-transact-sql.md)
46+
* [~ (Bitwise NOT)](../../t-sql/language-elements/bitwise-not-transact-sql.md)
47+
48+
The operands for bitwise operators can be any one of the data types of the integer or binary string data type categories (except for the **image** data type), except that both operands cannot be any one of the data types of the binary string data type category. The following table shows the supported operand data types.
49+
50+
|Left operand|Right operand|
51+
|------------------|-------------------|
52+
|[binary](../../t-sql/data-types/binary-and-varbinary-transact-sql.md)|**int**, **smallint**, or **tinyint**|
53+
|[bit](../../t-sql/data-types/bit-transact-sql.md)|**int**, **smallint**, **tinyint**, or **bit**|
54+
|[int](../../t-sql/data-types/int-bigint-smallint-and-tinyint-transact-sql.md)|**int**, **smallint**, **tinyint**, **binary**, or **varbinary**|
55+
|[smallint](../../t-sql/data-types/int-bigint-smallint-and-tinyint-transact-sql.md)|**int**, **smallint**, **tinyint**, **binary**, or **varbinary**|
56+
|[tinyint](../../t-sql/data-types/int-bigint-smallint-and-tinyint-transact-sql.md)|**int**, **smallint**, **tinyint**, **binary**, or **varbinary**|
57+
|[varbinary](../../t-sql/data-types/binary-and-varbinary-transact-sql.md)|**int**, **smallint**, or **tinyint**|
58+
59+
## See Also
60+
[Operators &#40;Transact-SQL&#41;](../../t-sql/language-elements/operators-transact-sql.md)
61+
[Data Types &#40;Transact-SQL&#41;](../../t-sql/data-types/data-types-transact-sql.md)
62+
6363

0 commit comments

Comments
 (0)