Hi i have a table DATEDESC with columns
SAMPLE DATA OUTPUT
NOT LEAP YEAR
I need to load a series of dates into this tale by giving a start and and end dates range. Lets say i need to load 10yrs of date's data into this column, i need to load all the dates into this table and get those respective column.
The query i had to populate the sample data was with the current date. But i am not sure how to do this for a bunch of data when it is in a range.
GETDATE() AS FULL_DATE,
Convert(varchar(10), getdate(),110) as DATE_NAME,
CASE (YEAR(GETDATE()))%4 WHEN 0 THEN 'LEAP YEAR'ELSE 'NOT LEAP YEAR' END AS [YEAR_NAME],
DATENAME(MONTH,GETDATE()) AS [MONTH_NAME],
DATENAME("DW",GETDATE()) AS [DAY_OF_THE_WEEK],
DATENAME(YEAR,GETDATE()) AS [YEAR_NUMBER],
MONTH(GETDATE()) AS MONTH_NUMBER,
DATEPART(DAY,GETDATE() -1)/7+1 AS [WEEK_WITHIN_MONTH],
DATENAME("WEEK",GETDATE()) AS [WEEK_WITHIN_YEAR],
DAY(GETDATE()) AS DAY_NUMBER
So, could you please help me in build this query.
View Complete Post