Sql server: Get month calendar with week day name | ASPMANTRA | Asp.Net,MVC,AngularJs,Jquery,Javascript,Sql Server AND WCF 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

Post a Comment

[blogger]

MKRdezign

Contact Form

Name

Email *

Message *

Powered by Blogger.
Javascript DisablePlease Enable Javascript To See All Widget