How do I determine a public holiday in Sql server?

前端 未结 24 1852
慢半拍i
慢半拍i 2020-12-05 14:40

I have an application written in c# that cannot run on a public holiday or a weekend. I\'ve looked around a bit and haven\'t found anywhere (official) that provides all the

24条回答
  •  离开以前
    2020-12-05 15:20

    I find this topic strange. After trying to find and write complicated functions in MS, PHP or in this case SQL language I came to the conclusion that it is a pointless exercise. The code I ended up contain over 2000 characters and takes hours to get right and debug. If you think about it all you have to do is write 7 number indicating the day 1-365 for each holiday and a row for each year for the next 100 years. You only need to load that years or the next years holidays once. So keep table with 7 columns and 100 rows and fill them up with the correct days. You only need to do this once every 100 years and take less than an hour and it is portable.

提交回复
热议问题