| title | Write (Database Engine) | Microsoft Docs | ||
|---|---|---|---|
| ms.custom | |||
| ms.date | 7/23/2017 | ||
| ms.prod | sql-non-specified | ||
| ms.prod_service | database-engine, sql-database | ||
| ms.service | |||
| ms.component | t-sql|data-types | ||
| ms.reviewer | |||
| ms.suite | sql | ||
| ms.technology |
|
||
| ms.tgt_pltfrm | |||
| ms.topic | language-reference | ||
| f1_keywords |
|
||
| dev_langs |
|
||
| helpviewer_keywords |
|
||
| ms.assetid | 7c554334-d2d9-4eae-a4ae-097aa4020e1a | ||
| caps.latest.revision | 13 | ||
| author | edmacauley | ||
| ms.author | edmaca | ||
| manager | craigg | ||
| ms.workload | Inactive |
[!INCLUDEtsql-appliesto-ss2008-asdb-xxxx-xxx-md]
Write writes out a binary representation of SqlHierarchyId to the passed-in BinaryWriter. Write cannot be called by using [!INCLUDEtsql]. Use CAST or CONVERT instead.
void Write( BinaryWriter w ) w
A BinaryWriter object to which the binary representation of this hierarchyid node will be written out.
CLR return type:void
Write is used internally by [!INCLUDEssNoVersion] when it is necessary, such as when loading data from a hierarchyid column. Write is also called internally when a conversion is done between hierarchyid and varbinary.
MemoryStream stream = new MemoryStream();
BinaryWriter bw = new BinaryWriter(stream);
hid.Write(bw);
byte[] encoding = stream.ToArray();
Read (Database Engine)
ToString (Database Engine)
CAST and CONVERT (Transact-SQL)
hierarchyid Data Type Method Reference