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
 Transact-SQL (2000)
 display months between 2 dates

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2005-09-12 : 07:44:45
vinay writes "Respected Sir
I want to display months between 2 dates
like startdate is 01/01/2005
and enddate is 01/05/2006
output should be
jan 2004
feb 2004
.... till
apr 2005
may 2005

with regards
vinay.r"

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2005-09-12 : 09:22:43
but you can do this:
for this you need a table of dates which you must create.
then you simply do:
select distinct datename(m, YourDateColumn) + datename(yy, YourDateColumn)
where YourDateColumn between '01/01/2005' and '01/05/2006'



Go with the flow & have fun! Else fight the flow
Go to Top of Page
   

- Advertisement -