jamesagnew
Programmer
I've been racking my brains for several days over this problem so I hope someone might be able to give me a nudge in the right direction.
I have a simple sql 2000 table as below
ID - StartDate - EndDate (table_1)
1 - 01/02/03 - 05/02/03
2 - 17/04/04 - 24/05/04
...
I need to look at ID=1, insert all the dates from 01/02/03 --> 05/02/03 into another table, and then repeat the process for the other records (id=2, id=3 etc), giving the following results:
ID - DateIntervals (table_2)
1 - 01/02/03
1 - 02/02/03
1 - 03/02/03
1 - 04/02/03
1 - 05/02/03
2 - 17/04/04
2 - 18/04/04
2 - 19/04/04
2 - 20/04/04 ...etc
I've got a basic insert working using DATEADD for each consecutive date, but the problem is being able to run the insert after each indivdual record in the first table - I'm stuck on how to look at an individual record i.e. id=1, perform an insert based on the value of id, and then move onto the next record. Can I do this without cursors? I especially don't want cold fusion handling this, so it needs to be performed by the db.
Any help greatly appreciated !
David
I have a simple sql 2000 table as below
ID - StartDate - EndDate (table_1)
1 - 01/02/03 - 05/02/03
2 - 17/04/04 - 24/05/04
...
I need to look at ID=1, insert all the dates from 01/02/03 --> 05/02/03 into another table, and then repeat the process for the other records (id=2, id=3 etc), giving the following results:
ID - DateIntervals (table_2)
1 - 01/02/03
1 - 02/02/03
1 - 03/02/03
1 - 04/02/03
1 - 05/02/03
2 - 17/04/04
2 - 18/04/04
2 - 19/04/04
2 - 20/04/04 ...etc
I've got a basic insert working using DATEADD for each consecutive date, but the problem is being able to run the insert after each indivdual record in the first table - I'm stuck on how to look at an individual record i.e. id=1, perform an insert based on the value of id, and then move onto the next record. Can I do this without cursors? I especially don't want cold fusion handling this, so it needs to be performed by the db.
Any help greatly appreciated !
David