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
No comments:
Post a Comment