Skip to content

Latest commit

 

History

History
59 lines (47 loc) · 1.92 KB

File metadata and controls

59 lines (47 loc) · 1.92 KB
title Write (Database Engine) | Microsoft Docs
ms.custom
ms.date 07/23/2017
ms.prod sql
ms.prod_service database-engine, sql-database
ms.reviewer
ms.technology t-sql
ms.topic language-reference
f1_keywords
Write_TSQL
Write
dev_langs
TSQL
helpviewer_keywords
Write [Database Engine]
ms.assetid 7c554334-d2d9-4eae-a4ae-097aa4020e1a
author MikeRayMSFT
ms.author mikeray
manager craigg

Write (Database Engine)

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

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