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
 General SQL Server Forums
 New to SQL Server Programming
 Arbitrary dates

Author  Topic 

MikeB
Constraint Violating Yak Guru

387 Posts

Posted - 2006-03-30 : 09:28:50
How can I select all the "filler" dates.


CREATE TABLE tbDateList
( ItemDate datetime )

INSERT INTO tbDateList (ItemDate)
SELECT '01/01/2006' UNION ALL
SELECT '01/10/2006'

SELECT * FROM tbDateList
DROP TABLE tbDateList


In the select statement, I want to select all dates in tbDateList, but I also want to include dates that are not in the list.

Eg: the above select * will return the 2 dates, but I want it to return the 10 dates, 01/01/2006 - '01/10/2006'

Any suggestions?

Mike B

robvolk
Most Valuable Yak

15732 Posts

Posted - 2006-03-30 : 09:31:03
Try this:

http://www.sqlteam.com/item.asp?ItemID=3332
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-03-30 : 09:33:20
Fill the gaps
http://www.mindsdoor.net/SQLTsql/FindGapsInSequence.html

Madhivanan

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

Srinika
Master Smack Fu Yak Hacker

1378 Posts

Posted - 2006-03-30 : 10:11:06
Also the following :
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=63920


Srinika
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2006-03-30 : 10:17:24
Another one for your reference http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=61519



KH

Choice is an illusion, created between those with power, and those without.
Concordantly, while your first question may be the most pertinent, you may or may not realize it is also the most irrelevant

Go to Top of Page
   

- Advertisement -