# question

## calculating dates in dfa manner

I have one table datecalculation it has the following columns
```| toNode | fromNode | days  |
|---------------------------|
|  1     |    12    |   80  |
|  3     |    5     |   45  |
|  4     |    6     |   54  |
...
```
the toNode is the result and the fromNode gives you the result by adding the amount of days to the fromNode The only date that I have is a created date form another table that in this case will be from node now. Example (first row of 'datecalculation' table)
```select createddate from nodes

createddate = 01/01/2013

createddate = fromnode 12

fromNode 12 + 80 days = 22/03/2013
```
toNode 1 now has this value and we in the datecalculation table where fromNode is id is 1 and use that to calculate the correlating toNode. Is there a way of traversing this table to get the results in a depth first algortihm manner? Is this possible in tsql? Many thanks in advance.
1 comment

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

can you explain in a bit more detail, and give examples of what result you need
0 Likes 0 ·

·
I'm not wholly sure what your problem is or where you are stuck but it is certainly possible to use data from a table to complete a value in a date manipulation function DECLARE @Store TABLE ( ID INT IDENTITY , AddVal INT ) INSERT @store ( AddVal ) VALUES ( 1 ), ( 5 ), ( 20 ), ( 60 ), ( 100 ) SELECT DATEADD(dd, AddVal, GETDATE()) FROM @store

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total. 