Order From Current Month Continues

Jayakumars
Posted by Jayakumars under ASP.NET AJAX category on | Points: 40 | Views : 867
hi
Order From Current Month Continues

Refer this
=============
http://www.dotnetfunda.com/forums/thread14114-query-to-fetch-data-from-table-based-on-the-flag-column.aspx


with cte as
(
select DATENAME(MONTH,getdate()) as monthname,0 as intcount
union all
select DATENAME(MONTH,DATEADD(MONTH, intcount +1,getdate())), intcount +1 from cte
where intcount <11
)
select monthname from cte




add One Month
====================

with cte as
(
select DATENAME(MONTH,getdate()+27) as monthname,0 as intcount
union all
select DATENAME(MONTH,DATEADD(MONTH, intcount +1,getdate()+27)), intcount +1 from cte
where intcount <11
)
select monthname from cte

Comments or Responses

Login to post response