0

I want to loop date from start to end based on month and year. For example

Month is 12 and year is 2014.

01 Dec 2014 
02 Dec 2014 
03 Dec 2014 
.
.

31 Dec 2014 
1
  • Which database - sql server, postgres etc ? Commented Dec 30, 2014 at 3:59

1 Answer 1

1

using Recursive CTE

with CTE
as
(
select N=0
UNION ALL 
select N+1 from CTE where N<30

)select CONVERT( CHAR(12),DATEADD(D,N,CAST('2014-12-01' as DATE)),106)  from CTE
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.