Listing all the dates between 2 dates

  • Hi Guys

    Need some help.

    EDIT: SQL Server 2000

    I have a date_to & date_from columns. What I need to do is list all the dates in between them

    For example

    date to date from

    01/01/2009 12/01/2009

    Results:

    01/01/2009

    02/01/2009

    03/01/2009

    04/01/2009

    \/

    12/01/2009

    Help and comments muchly appreciate.

    Thanks

    Glen

  • How much SQL knowledge do you have?



    Alvin Ramard
    Memphis PASS Chapter[/url]

    All my SSC forum answers come with a money back guarantee. If you didn't like the answer then I'll gladly refund what you paid for it.

    For best practices on asking questions, please read the following article: Forum Etiquette: How to post data/code on a forum to get the best help[/url]

  • Intermediate. If it was SQL 2005 I would of used a CTE but I cant do that with SQL 2000.

  • Glen Cooley (5/7/2009)


    Intermediate. If it was SQL 2005 I would of used a CTE but I cant do that with SQL 2000.

    You can use a derived table. You put it where you would put the name of your CTE.

  • I guess I misunderstood. I thought you wanted dates from a column where these dates were between 2 given dates, but I see want now.



    Alvin Ramard
    Memphis PASS Chapter[/url]

    All my SSC forum answers come with a money back guarantee. If you didn't like the answer then I'll gladly refund what you paid for it.

    For best practices on asking questions, please read the following article: Forum Etiquette: How to post data/code on a forum to get the best help[/url]

  • Lynn Pettis (5/7/2009)


    Glen Cooley (5/7/2009)


    Intermediate. If it was SQL 2005 I would of used a CTE but I cant do that with SQL 2000.

    You can use a derived table. You put it where you would put the name of your CTE.

    Ah very good idea!

    Thank you

Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic. Login to reply