Wednesday, 26 August 2015
Tuesday, 4 August 2015
Get Month base on to date and from date
declare @StartDate date
declare @EndDate date
SELECT TOP 1 @StartDate=AcademicYearFrom,@EndDate=AcademicYearTo
FROM [LMS_Tbl_AcademicYear]
select distinct MonthNames,MonthNum from (
select DATENAME(month,AllDates) AS MonthNames,month(AllDates) AS MonthNum from (
SELECT DATEADD(MM, number, @StartDate) AS AllDates
FROM MASTER..spt_values main
WHERE TYPE = 'p'
)getDates
WHERE AllDates<=@EndDate
)mont
order by MonthNum
declare @EndDate date
SELECT TOP 1 @StartDate=AcademicYearFrom,@EndDate=AcademicYearTo
FROM [LMS_Tbl_AcademicYear]
select distinct MonthNames,MonthNum from (
select DATENAME(month,AllDates) AS MonthNames,month(AllDates) AS MonthNum from (
SELECT DATEADD(MM, number, @StartDate) AS AllDates
FROM MASTER..spt_values main
WHERE TYPE = 'p'
)getDates
WHERE AllDates<=@EndDate
)mont
order by MonthNum
Subscribe to:
Posts (Atom)