Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8772303
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T18:00:21+00:00 2026-06-13T18:00:21+00:00

The following link explains how to turn a date range into a list of

  • 0

The following link explains how to turn a date range into a list of dates.
I used this approach and it works fine but the query is not performing (I used Maxrecursion 0 to unlimit).

http://blog.justinstolle.com/sql-turn-a-date-range-into-a-list-of-dates/

Is there any other solution to get this done? (using subquery or declare table?)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T18:00:23+00:00Added an answer on June 13, 2026 at 6:00 pm

    Try

    declare @datestart date = '2012-1-1',   @dateend date = '2012-10-31'
    
    declare @days int = datediff(d,@datestart,@dateend)
    
    select
        dateadd(d, number, @datestart)
    from master..spt_values 
    where type='p'
        and number<=@days
    

    If your date range is more than 2047 days, you can extend it by self joining the table – the below will allow you up to 27 years..

    select
        dateadd(d, v1.number+v2.number*2048, @datestart)
    from master..spt_values v1
        cross join (select number from master..spt_values where number<5 and type='p') v2       
    where type='p'
        and (v1.number+v2.number*2048)<=@days
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to get distance text from following link. i have used NSXML parsing
I am using bitlyj snapshot jar to shorten URLs from the following link. http://code.google.com/p/bitlyj/downloads/list
I'm reading a Ruby book but it doesn't explain the following: What is this:
I'm following this example for connecting to the Bing Maps geocode service: Link About
I'm following this tutorial: http://railscasts.com/episodes/253-carrierwave-file-uploads or atleast I want to but would like to
I searched Google on how to do this, and I got the following link:
Following my previous post in this link I have another problem . Given the
I want to do the following: To create a checking with a link. This
I have the following link on index page <td align=center><a href=../athena/admin/update.php?id=' . $data [keyword]
I have the following link function MyLinqToSQLTable.Where(x => x.objectID == paramObjectID).ToList(); I most of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.