Viewing 7 posts - 1 through 7 (of 7 total)
Wow!!! It works great!!!
Thanks Dave, and Gianluca you too.
-Deepak
July 14, 2009 at 7:52 am
No luck dave,
Here is the DDL and Sample data:
DECLARE @RTest TABLE
(
RecordID int,
ParentRecordId int,
Credit int
)
INSERT INTO @RTest VALUES (1,NULL,10)
INSERT INTO @RTest VALUES (2,NULL,5)
INSERT INTO...
July 14, 2009 at 7:34 am
Hi Gianluca,
Your solution too has a bug. It is not adding the third level of child. When I run it, it gives the following result:
RecordID SumCredit
125
220
The Sum of RecordID...
July 14, 2009 at 7:27 am
Why this problem is different with others is that here the t-sql statement should be able to sum the credits of n level of child records for the main parent...
July 14, 2009 at 7:04 am
Dave, it does not work. It throws the following error:
Msg 530, Level 16, State 1, Line 1
The statement terminated. The maximum recursion 100 has been exhausted before statement completion.
I swap...
July 14, 2009 at 6:51 am
Try this to get the records start with "Cu_"
select * from #Like_Test where Col1 Like 'Cu[_]%'
September 10, 2008 at 12:51 pm
Viewing 7 posts - 1 through 7 (of 7 total)