SQL Flow Field Guide

hierarchyid.Write

Catalog support for SQL Server 2022 (16.x) and 2025 (17.x)

Write is a CLR-only method (not callable from T-SQL per Learn return type void)

What changes

Input
binary stream (CLR only)
Output or change
hierarchyid
Return type
CLR return type:void

Syntax at a glance

void Write( BinaryWriter w )

Work example

Use the CLR serialization method when a .NET component writes hierarchyid binary data.

Keep this method inside the documented CLR integration path and prefer T-SQL hierarchy methods for normal inserts.

Check your work Write is a serialization method and is not a regular scalar T-SQL method call.

Open Microsoft Learn for full syntax, permissions, and details for your version.