![]() ![]() OR (d.Date = Auxiliary.Computus(YEAR(Date))+39) - Ascension Day OR (d.Date = Auxiliary.Computus(YEAR(Date))) - Easter Sunday OR (d.Date = Auxiliary.Computus(YEAR(Date))-2) - Good Friday OR (d.Date = Auxiliary.Computus(YEAR(Date))-3) - Maundy Thursday OR (d.Date = Auxiliary.Computus(YEAR(Date))-7) - Palm Sunday WHEN (DATEPART(DayOfYear, d.Date) = 1) - New Year's Day For other countries and states: Wikipedia - List of holidays by country ![]() ![]() Fiscal year may be different to the actual year in Norway the are the sameĭATEPART(Quarter, d.Date) AS Fiscal_Quarter, SELECT ROW_NUMBER() OVER(partition by year(Date) order by Date) Week, ThursdayĭATEPART(DayOfYear, d.Date) AS DayOfYear, Now we produce the weeknumers for the thursdays the thursday in the week for a particular date The weeks can be found by counting the thursdays in a year so we find SELECT cast('1999' AS DateTime) Date - SQL Server supports the ISO 8601 format so this is an unambigious shortcut for A recursive CTE that produce all dates between 19-12-31 I want my table to contain datedata acording to ISO 8601 just amend the start and end dates: IF EXISTS (SELECT * FROM information_schema.tables WHERE Table_Name = 'Calendar' AND Table_Type = 'BASE TABLE')ĪND ( IN ('HOLIDAY', 'SATURDAY', 'SUNDAY', 'BANKDAY'))) Here is a generic script you can use in SQL server. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |