sriram
;with cte as ( select GETDATE() Today ) select * from cte
Declare @StartDay datetime, @EndDay datetime Set @StartDay='2012-06-01' Set @EndDay='2012-06-30' ;with cte(Date) as ( select @StartDay union all select Date+1 from cte where Date < @EndDay ) select Date,DATENAME(W,Date)Day from cte
Declare @StartDay datetime, @EndDay datetime Set @StartDay='2012-01-01' Set @EndDay='2012-12-31' ;with cte(Date) as ( select @StartDay union all select Date+1 from cte where Date < @EndDay ) select DATENAME(M,Date)Day ,count(Date)NoOfDays from cte group by DATENAME(M,Date) option (MAXRECURSION 1000)
Rajesh Patel R.P.A Developer | Developer Trainer | Clean Code Evangelist
Regards Muralidoss M
Login to post response