Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Regarding Dates

Author  Topic 

rammohan
Posting Yak Master

212 Posts

Posted - 2007-06-06 : 11:35:09
here i wabt to get the dates b/w two input dates.
i.e
input : date1: 11/2/2004
date2 : 14/2/2004

i want out put as
12/2/2004
13/2/2004
please suggest me a function or query to acheive this

One can never consent to creep,when one feels an impulse to soar
RAMMOHAN

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2007-06-06 : 11:36:55
Make use of F_Table_Date function here: [url]http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=61519[/url]

Harsh Athalye
India.
"The IMPOSSIBLE is often UNTRIED"
Go to Top of Page

ranganath
Posting Yak Master

209 Posts

Posted - 2007-06-07 : 01:32:28
Declare @StartDate datetime, @EndDate datetime
Select @startDate = '7/2/2007', @EndDate = '7/5/2007'

Select * from
(select date = dateadd(day,number,@StartDate) from master..spt_values
where name is null and type='P' and number > 0 and
number <= (datepart(day, @EndDate) - datepart(day,@StartDate))) as b
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2007-06-07 : 10:44:48
Similar logic
http://www.mindsdoor.net/SQLTsql/FindGapsInSequence.html


Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -