SQL Server
但SQL
一般我們使用的時候
CREATE TABLE Employees
(
Org_Id hierarchyid NOT NULL
EmployeeId INT NOT NULL
EmployeeName VARCHAR(
Title VARCHAR(
)
GO
INSERT INTO dbo
INSERT INTO dbo
INSERT INTO dbo
INSERT INTO dbo
INSERT INTO dbo
INSERT INTO dbo
SELECT * FROM dbo
SELECT *
DECLARE @BOSS hierarchyid
SELECT @BOSS=Org_Id FROM Employees WHERE EmployeeID=
SELECT *
DECLARE @Employee hierarchyid
SELECT @Employee=Org_Id FROM Employees WHERE EmployeeID=
SELECT *
與hierarchyid有關的一些函數主要有
GetAncestor
GetDescendant
GetLevel
GetRoot
IsDescendantOf
Parse
Read
Read 從傳入的 BinaryReader 讀取 SqlHierarchyId 的二進制表示形式
GetReparentedValue
ToString
Write
Write 將 SqlHierarchyId 的二進制表示形式寫出到傳入的 BinaryWriter 中
From:http://tw.wingwit.com/Article/program/SQLServer/201311/22307.html