Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

Read (Database Engine)

Read reads binary representation of SqlHierarchyId from the passed-in BinaryReader and sets the SqlHierarchyId object to that value. Read cannot be called by using Transact-SQL. Use CAST or CONVERT instead.


void Read( BinaryReader r ) 
r

The BinaryReader object that produces a binary stream corresponding to a binary representation of a hierarchyid node.

CLR return type: void

Read does not validate its input. If an invalid binary input is given, Read might raise an exception. Or, it might succeed and produce an invalid SqlHierarchyId object whose methods can either give unpredictable results or raise an exception.

Read can only be called on a newly created SqlHierarchyId object.

Read is used internally by SQL Server when it is necessary, such as when writing data to hierarchyid column. Read is also called internally when a conversion is done between varbinary and hierarchyid.

Byte[] encoding = new byte[] { 0x58 };
MemoryStream stream = new MemoryStream(encoding, false /*not writable*/);
BinaryReader br = new BinaryReader(stream);
SqlHierarchyId hid = new SqlHierarchyId();
hid.Read(br); 
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.