TSQL recursive query
Ideally it should be something like thisWITH Parent AS( SELECT [ParentID],ChildID,Value FROM [DynamicColsValues_TP1] WHERE ParentID IS null UNION ALL SELECT t1.[ParentID],t1.ChildID,T1.Value FROM...
View ArticleTSQL recursive query
Hi DBALearner,In which column you are maintaining ChildId, if you are using value column for it then try below WITH Parent AS( SELECT[ParentID],ValueFROM[DynamicColsValues_TP1]WHEREValue IS null...
View ArticleTSQL recursive query
Hi DBALearner, The problem can be the JOIN ON condition. Please see below correction basing on my assumption.DECLARE @DynamicColsValues_TP1 TABLE(ParentID INT,VALUE INT) INSERT INTO...
View ArticleTSQL recursive query
sorry your code has only single field ParentID. Can I ask which field stores the child details?Please Mark This As Answer if it solved your issue Please Vote This As Helpful if it helps to solve your...
View ArticleTSQL recursive query
Hi All,I need to write recursive query to find child of a parent until the last leaf. Below is my code. ;WITH Parent AS( SELECT [ParentID],Value FROM [DynamicColsValues_TP1] WHERE Value IS null UNION...
View Article
More Pages to Explore .....