Skip to content

Latest commit

 

History

History
55 lines (44 loc) · 1.85 KB

write-database-engine.md

File metadata and controls

55 lines (44 loc) · 1.85 KB
title description author ms.author ms.date ms.service ms.subservice ms.topic f1_keywords helpviewer_keywords dev_langs monikerRange
Write (Database Engine)
Write (Database Engine)
MikeRayMSFT
mikeray
07/23/2017
sql
t-sql
reference
Write_TSQL
Write
Write [Database Engine]
TSQL
=azuresqldb-current || >=sql-server-2016 || >=sql-server-linux-2017 || =azuresqldb-mi-current ||=fabric

Write (Database Engine)

[!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.

Syntax

void Write( BinaryWriter w )

Arguments

w
A BinaryWriter object to which the binary representation of this hierarchyid node will be written out.

Return Types

CLR return type:void

Remarks

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.

Examples

MemoryStream stream = new MemoryStream();  
BinaryWriter bw = new BinaryWriter(stream);  
hid.Write(bw);  
byte[] encoding = stream.ToArray();  

See also

Read (Database Engine)
ToString (Database Engine)
CAST and CONVERT (Transact-SQL)
hierarchyid Data Type Method Reference