ToString (Veritabanı Altyapısı)
Returns a string with the logical representation of this.ToString is called implicitly when a conversion from hierarchyid to a string type occurs.Bunun tersi olarak görev yapar (Veritabanı Altyapısı) ayrıştırılamadı..
-- Transact-SQL syntax
node.ToString ( )
-- This is functionally equivalent to the following syntax
-- which implicitly calls ToString():
CAST(node AS nvarchar(4000))
-- CLR syntax
string ToString ( )
Dönüş Türleri
**SQL Server dönüş türü:**nvarchar(4000)
**CLR dönüş türü:**String
Remarks
Mantıksal konumu, hiyerarşik olarak verir.For example, /2/1/ represents the fourth row (Microsoft SQL Server) in the following hierarchical structure of a file system:
/ C:\
/1/ C:\Database Files
/2/ C:\Program Files
/2/1/ C:\Program Files\Microsoft SQL Server
/2/2/ C:\Program Files\Microsoft Visual Studio
/3/ C:\Windows
Örnekler
C.Transact-SQL örnek tablo
Aşağıdaki örnek, her ikisi de verir OrgNode Her iki sütun hierarchyid veri türü ve daha okunabilir dize biçimi:
SELECT OrgNode,
OrgNode.ToString() AS Node
FROM HumanResources.EmployeeDemo
ORDER BY OrgNode ;
GO
Here is the result set.
OrgNode Node
0x /
0x58 /1/
0x5AC0 /1/1/
0x5B40 /1/2/
0x5BC0 /1/3/
0x5C20 /1/4/
...
b.Transact-SQL değerleri tablosu olmadan dönüştürme
Aşağıdaki kod örneği kullanır. ToString dönüştürülecek bir hierarchyid bir dize değerine ve Parse bir dize değerine dönüştürmek için bir hierarchyid.
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
Here is the result set.
hierarchyidRepresentation StringRepresentation
------------------------- -----------------------
0x5ADE /1/1/3/
c.CLR örnek
Parçacık çağrıları aşağıdaki kod ToString() yöntem:
this.ToString()
See Also