SqlHierarchyId.Parse Method (SqlString)

 

Applies To: SQL Server 2016 Preview

Converts the canonical string representation of a SqlHierarchyId node to a SqlHierarchyId value.

Namespace:   Microsoft.SqlServer.Types
Assembly:  Microsoft.SqlServer.Types (in Microsoft.SqlServer.Types.dll)

Syntax

[SqlMethodAttribute(DataAccess = DataAccessKind.None, SystemDataAccess = SystemDataAccessKind.None, 
    InvokeIfReceiverIsNull = false, OnNullCall = false, IsDeterministic = true, 
    IsPrecise = true, IsMutator = false)]
public static SqlHierarchyId Parse(
    SqlString input
)
public:
[SqlMethodAttribute(DataAccess = DataAccessKind::None, SystemDataAccess = SystemDataAccessKind::None, 
    InvokeIfReceiverIsNull = false, OnNullCall = false, IsDeterministic = true, 
    IsPrecise = true, IsMutator = false)]
static SqlHierarchyId Parse(
    SqlString input
)
[<SqlMethodAttribute(DataAccess = DataAccessKind.None, SystemDataAccess = SystemDataAccessKind.None,
    InvokeIfReceiverIsNull = false, OnNullCall = false, IsDeterministic = true,
    IsPrecise = true, IsMutator = false)>]
static member Parse : 
        input:SqlString -> SqlHierarchyId
<SqlMethodAttribute(DataAccess := DataAccessKind.None, SystemDataAccess := SystemDataAccessKind.None,
    InvokeIfReceiverIsNull := False, OnNullCall := False, IsDeterministic := True,
    IsPrecise := True, IsMutator := False)>
Public Shared Function Parse (
    input As SqlString
) As SqlHierarchyId

Parameters

Return Value

Type: Microsoft.SqlServer.Types.SqlHierarchyId

SqlHierarchyId representing the node described canonically.

Remarks

Called implicitly when a conversion from a string type to SqlHierarchyId data type occurs.

Acts as the opposite of ToString.

An exception is raised if Parsereceives a value that is not a valid string representation of a SqlHierarchyId.

This member is static.

Examples

Legacy Code Example

DECLARE @StringValue AS nvarchar(4000), @hierarchyidValue AS hierarchyid
SET @StringValue = '/1/1/3/'
SET @hierarchyidValue = 0x5ADE

SELECT hierarchyid::Parse(@StringValue) AS hierarchyidRepresentation,
 @hierarchyidValue.ToString() AS StringRepresentation ;
GO

See Also

SqlHierarchyId Structure
Microsoft.SqlServer.Types Namespace

Return to top