Sql server: Get month calendar with week day name - Free Asp.Net,MVC,AngularJs,Jquery,Javascript,Sql Server,WCF,Entity framework snippets and tutorial

Sql server: Get month calendar with week day name

In this article I am going to explain how to get month calendar with week day name in sql server.


Implementation:

To get month calendar with week day name run the below given query in Sql server:


declare @StartDate datetime
declare @Enddate datetime
set @StartDate = '20160601'

set @Enddate ='20160630'
;with dates as(
    select @StartDate as sdt
    union all
    select DATEADD(d,1,sdt) from dates where sdt<@Enddate
)
select ROW_NUMBER() OVER (ORDER BY sdt) AS [serial number], sdt as [Date], datename(dw,sdt)as [Week Day Name] from dates



Result:
Sql server: Get month calendar with week day name

What do you think about this article?

If you found this article useful, please share and follow on Facebook, Twitter, Google Plus and other social media websites. To get free updates subscribe to newsletter. Please put your thoughts and feedback in comments section.

Share this

Share on FacebookTweet on TwitterPlus on Google+


EmoticonEmoticon