-- 查找所有父節點with tab as( select Type_Id,ParentId,Type_Name from Sys_ParamType_V2_0 where Type_Id=316--子節點 union all select b.Type_Id,b.ParentId ...
在SQL的樹型結構中,很多時候,知道某一節點的值,需要查找該節點的所有子節點 包括多級 的功能,這時就需要用到如下的用戶自定義函數. 表結構如下: ID int Dep Type int Dep Code varchar Dep Name varchar Dep Dian int Dep FathID int Dep Opera varchar Dep Status int Dep AddTime ...
2014-08-22 11:14 0 3401 推薦指數:
-- 查找所有父節點with tab as( select Type_Id,ParentId,Type_Name from Sys_ParamType_V2_0 where Type_Id=316--子節點 union all select b.Type_Id,b.ParentId ...
-- 查找所有父節點with tab as( select Type_Id,ParentId,Type_Name from Sys_ParamType_V2_0 where Type_Id=316--子節點 union all select b.Type_Id,b.ParentId ...
起因:業務中用到了element級聯選擇器,級聯的反顯需要這樣的數據[id(父),id(父),id(當前選中)],由於后端的無能,不會遍歷找所有關聯的父節點,只能由前端來做,所以就寫了一個簡單的遞歸。 ...
Declare @Id Int Set @Id = 0; ---在此修改父節點 With RootNodeCTE(D_ID,D_FatherID,D_Name,lv) As ( Select D_ID,D_FatherID,D_Name,0 as lv From [LFBMP.LDS ...
List<MyManageFolderInfoResponse> listParentGolder = new List<MyManageFolderInfoResponse>(); /// <summary> /// 獲取當前節點和所有父節點 /// < ...
with t as ( select b.* from Base_Department b where ParentId = 'cce4152c-3483-4334-b68d-155da62 ...