| title | Write (Database Engine) | ||
|---|---|---|---|
| description | Write (Database Engine) | ||
| author | MikeRayMSFT | ||
| ms.author | mikeray | ||
| ms.date | 07/23/2017 | ||
| ms.service | sql | ||
| ms.subservice | t-sql | ||
| ms.topic | reference | ||
| ms.custom |
|
||
| f1_keywords |
|
||
| helpviewer_keywords |
|
||
| dev_langs |
|
||
| monikerRange | =azuresqldb-current || >=sql-server-2016 || >=sql-server-linux-2017 || =azuresqldb-mi-current || =fabric-sqldb |
[!INCLUDE SQL Server Azure SQL Database Azure SQL Managed Instance FabricSQLDB]
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