SELECT Folder_ID ,Folder_Name ,Folder_ParentId FROM dbo. Folder遞歸語句:在此我們以ADO.NET為例,查詢ADO.NET下的子節點:WITHTempFolder(Folder_ID,Folder_Name,Folder_ParentId...
SELECT Folder_ID ,Folder_Name ,Folder_ParentId FROM dbo. Folder 遞歸語句: 在此我們以ADO.NET為例,查詢ADO.NET下的子節點: WITH TempFolder(Folder_ID,Folder_Name,Folder_ParentId)as ( SELECT Folder_ID , Folder_Name,Folder_ParentId FROM Folder WHERE Folder_ID ='32784691-D1F8-433B-88E3-A35A032470B4' UNION ALL SELECT A. Folder_ID, A. Folder_Name,A .Folder_ParentId FROM Folder A ,TempFolder T where A. Folder_ParentId=T .Folder_ID ) 查詢結果: SELECT * FROM TempFolder