In
this article I am going to explain how to get month calendar with week day name
in sql server.
In
the previous article I have explained how to get the current month name withnumber of days in Sql server, how to get the number of days in current month inSql server , how to create autocomplete textbox using angularjs in asp.net mvcapplication, how to fill dropdownlist using AngularJs in MVC and how topopulate dropdownlist based on another dropdownlist using AngularJs in MVC.
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:
No comments:
Post a Comment