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

Commit 3f3b829

Browse files
authored
Merge pull request #9140 from damabe/1429836-Part4
TsqlAcrolinxScores: User Story 1429836, Part 4
2 parents b7673d6 + 0414a41 commit 3f3b829

10 files changed

Lines changed: 598 additions & 544 deletions

docs/t-sql/data-types/binary-and-varbinary-transact-sql.md

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,14 @@ monikerRange: ">=aps-pdw-2016||=azuresqldb-current||=azure-sqldw-latest||>=sql-s
2929
Binary data types of either fixed length or variable length.
3030

3131
## Arguments
32-
**binary** [ ( *n* ) ]
33-
Fixed-length binary data with a length of *n* bytes, where *n* is a value from 1 through 8,000. The storage size is *n* bytes.
32+
**binary** [ ( _n_ ) ]
33+
Fixed-length binary data with a length of _n_ bytes, where _n_ is a value from 1 through 8,000. The storage size is _n_ bytes.
3434

35-
**varbinary** [ ( *n* | **max**) ]
36-
Variable-length binary data. *n* can be a value from 1 through 8,000. **max** indicates that the maximum storage size is 2^31-1 bytes. The storage size is the actual length of the data entered + 2 bytes. The data that is entered can be 0 bytes in length. The ANSI SQL synonym for **varbinary** is **binary varying**.
35+
**varbinary** [ ( _n_ | **max**) ]
36+
Variable-length binary data. _n_ can be a value from 1 through 8,000. **max** indicates that the maximum storage size is 2^31-1 bytes. The storage size is the actual length of the data entered + 2 bytes. The data that is entered can be 0 bytes in length. The ANSI SQL synonym for **varbinary** is **binary varying**.
3737

3838
## Remarks
39-
When *n* is not specified in a data definition or variable declaration statement, the default length is 1. When *n* is not specified with the CAST function, the default length is 30.
39+
The default length is 1 when _n_ isn't specified in a data definition or variable declaration statement. When _n_ isn't specified with the CAST function, the default length is 30.
4040

4141
| Data type | Use when ... |
4242
| --- | --- |
@@ -46,11 +46,23 @@ When *n* is not specified in a data definition or variable declaration statement
4646

4747

4848
## Converting binary and varbinary data
49-
When data is converted from a string data type (**char**, **varchar**, **nchar**, **nvarchar**, **binary**, **varbinary**, **text**, **ntext**, or **image**) to a **binary** or **varbinary** data type of unequal length, [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)] pads or truncates the data on the right. When other data types are converted to **binary** or **varbinary**, the data is padded or truncated on the left. Padding is achieved by using hexadecimal zeros.
49+
When converting data from a string data type to a **binary** or **varbinary** data type of unequal length, [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)] pads or truncates the data on the right. These string data types are:
50+
51+
* **char**
52+
* **varchar**
53+
* **nchar**
54+
* **nvarchar**
55+
* **binary**
56+
* **varbinary**
57+
* **text**
58+
* **ntext**
59+
* **image**
60+
61+
When other data types are converted to **binary** or **varbinary**, the data is padded or truncated on the left. Padding is achieved by using hexadecimal zeros.
5062

51-
Converting data to the **binary** and **varbinary** data types is useful if **binary** data is the easiest way to move around data. Converting any value of any type to a binary value of large enough size and then back to the type, always results in the same value if both conversions are taking place on the same version of [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)]. The binary representation of a value might change from version to version of [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)].
63+
Converting data to the **binary** and **varbinary** data types is useful if **binary** data is the easiest way to move around data. At some point, you might convert a value type to a binary value of large enough size and then convert it back. This conversion always results in the same value if both conversions are taking place on the same version of [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)]. The binary representation of a value might change from version to version of [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)].
5264

53-
You can convert **int**, **smallint**, and **tinyint** to **binary** or **varbinary**, but if you convert the **binary** value back to an integer value, this value will be different from the original integer value if truncation has occurred. For example, the following SELECT statement shows that the integer value `123456` is usually stored as a binary `0x0001e240`:
65+
You can convert **int**, **smallint**, and **tinyint** to **binary** or **varbinary**. If you convert the **binary** value back to an integer value, this value will be different from the original integer value if truncation has occurred. For example, the following SELECT statement shows that the integer value `123456` is stored as a binary `0x0001e240`:
5466

5567
```sql
5668
SELECT CAST( 123456 AS BINARY(4) );

docs/t-sql/data-types/getreparentedvalue-database-engine.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ manager: craigg
2222
# GetReparentedValue (Database Engine)
2323
[!INCLUDE[tsql-appliesto-ss2008-asdb-xxxx-xxx-md](../../includes/tsql-appliesto-ss2008-asdb-xxxx-xxx-md.md)]
2424

25-
Returns a node whose path from the root is the path to *newRoot*, followed by the path from *oldRoot* to *this*.
25+
Returns a node whose path from the root is the path to _newRoot_, followed by the path from _oldRoot_.
2626

2727
## Syntax
2828

@@ -37,24 +37,24 @@ SqlHierarchyId GetReparentedValue ( SqlHierarchyId oldRoot , SqlHierarchyId newR
3737
```
3838

3939
## Arguments
40-
*oldRoot*
40+
_oldRoot_
4141
A **hierarchyid** that is the node that represents the level of the hierarchy that is to be modified.
4242

43-
*newRoot*
44-
A **hierarchyid** that represents the node that will replace the *oldRoot* section of the current node in order to move the node.
43+
_newRoot_
44+
A **hierarchyid** that represents the node. Replace the _oldRoot_ section of the current node to move the node.
4545

4646
## Return Types
4747
**SQL Server return type:hierarchyid**
4848

4949
**CLR return type:SqlHierarchyId**
5050

5151
## Remarks
52-
Can be used to modify the tree by moving nodes from *oldRoot* to *newRoot*. GetReparentedValue can be used to move a node of a hierarchy to a new location in the hierarchy. The **hierarchyid** data type represents but does not enforce the hierarchical structure. Users must ensure that the hierarchyid is appropriately structured for the new location. A unique index on the **hierarchyid** data type can help prevent duplicate entries. For an example of moving an entire subtree, see [Hierarchical Data (SQL Server)](../../relational-databases/hierarchical-data-sql-server.md).
52+
Used to modify the tree by moving nodes from _oldRoot_ to _newRoot_. GetReparentedValue is used to move a hierarchy node to a new location in the hierarchy. The **hierarchyid** data type represents but doesn't enforce the hierarchical structure. Users must ensure that the hierarchyid is appropriately structured for the new location. A unique index on the **hierarchyid** data type can help prevent duplicate entries. For an example of moving an entire subtree, see [Hierarchical Data (SQL Server)](../../relational-databases/hierarchical-data-sql-server.md).
5353

5454
## Examples
5555

5656
### A. Comparing two node locations
57-
The following example shows the current hierarchyid of a node. It also shows what the **hierarchyid** of the node would be if the node were moved to become a descendant of the **@NewParent** node. It uses the `ToString()` method to show the hierarchical relationships.
57+
The following example shows the current hierarchyid of a node. It also shows what the **hierarchyid** of the node would be if you move the node to become a descendant of the **@NewParent** node. It uses the `ToString()` method to show the hierarchical relationships.
5858

5959
```sql
6060
DECLARE @SubjectEmployee hierarchyid , @OldParent hierarchyid, @NewParent hierarchyid

0 commit comments

Comments
 (0)