Click here to Skip to main content
15,891,136 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi,
I have table structure like below
TaskId INT
,ParentId INT FK
,Progress Float

Sample data
TaskId,ParentId,Progress
1,NULL,0
2,1,0
3,2,0
4,2,0

If I update progress for the taskId = 4 then its parent's progress should update for example progress of TaskId=2 and since Parent of TaskId = 2 is 1 then progress of TaskId = 1 should get updated.

I have created a trigger but it only update the progress of TaskId = 2.

How can I achieve it ?
Posted
Comments
CHill60 10-Mar-15 9:27am    
What's in the trigger?
Maciej Los 10-Mar-15 9:44am    
What have you tried?

1 solution

I have done it by handling recursive call using common table expression inside trigger.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900