Using SQL Server 2005
I want to generate the table values between the two dates
Table1
ID Date Intime Outtime
01 12-02-2009 10:00:00 17:00:00
02 13-02-2009 08:00:00 16:00:00
03 14-02-2009 09:00:00 21:00:00
04 15-02-2009
Suppose I want to generate the above table values between the two dates.
For Example,
Given Date: start date - 12-02-2009 to end date - 12-03-2009
Expected Output
ID Date Intime Outtime
01 12-02-2009 10:00:00 17:00:00
02 13-02-2009 08:00:00 16:00:00
03 14-02-2009 09:00:00 21:00:00
04 15-02-2009
05 16-02-2009 10:00:00 17:00:00
06 17-02-2009 08:00:00 16:00:00
07 18-02-2009 09:00:00 21:00:00
08 19-02-2009
09 20-02-2009 10:00:00 17:00:00
…,
So From the table1 we have 4 Rows, so the 4 rows will repeat up to the given end date but id and date should increment, id and date should not repeat
How to make a SQL Query for this condition?
Need Query Help.