DBA > Articles

The SQL of the Feast Days of Western Christendom

By: Phil Factor
To read more DBA articles, visit http://dba.fyicenter.com/article/

I've been intrigued for a long time by the Christian feasts. Nowadays, we start getting excited about Christmas around July, and it is considered by commerce to be fair-game as a de-walletizing activity from Halloween onwards. I would like far more feast days to get excited about. Our ancestors had so many feast days that they didn't bother with dates. Any day could be described by its' saint, feast or remembrance. Dates were generally spoken of by their proximity to the nearest feast day. Now we have boring national days that nobody really feels like celebrating unless it means a day off work. Every day in the year is celebrated somewhere in Christendom by at least one saint. Some days have five or six candidates depending on the nation or region. When Europe was christianised, the policy was the ‘light touch’. The existing gods and ancestral figures were merely made into saints. Regions that had a different ancestral figure for each extended family ended up with thousands of saints. This was definitely promotion

Why stop at the western Christian church? The calculation of Ramadan is very difficult to pin down and the Islamic Hijri calendar is difficult to calculate from the Gregorian calendar as it is based on observation and astronomical calculation. The Hindu feast days depend on which of eight calendars you choose (Only the names of the twelve months are the same though not in the same order). Apologies for sticking with Western Christianity.

I've been determined to produce a SQL Expression that was able to tell you when all the feasts and saints days are. In the following example, I've only put the major feast days that were generally celebrated in Britain before the reformation, but it is very easy to add or take away what I've given you to taste. There are two main ways of determining the date of a feast. The easiest ones happen on the same date every year. The most important ones are the movable feasts, based on Easter. They all take place a fixed number of days from Easter Sunday. The calculation of Easter, the so-called 'Computus', isn't easy. It varies by over 40 days since it depends partly on the phase of the moon. Whole books have been written on the subject. Finally, there are the anomalous ones, such as Advent, which takes place on the nearest sunday to St Andrews' day, which is a fixed date. Advent therefore will vary over seven days.

I wanted to be able to produce a calendar of dates for as many years as you wanted in one SQL Expression. I thought I'd produce something that used the date features that were introduced in SQL Server 2012. With a little refactoring you can get something that will work in SQL Server 2005. Here is what I wrote

Full article...


Other Related Articles

... to read more DBA articles, visit http://dba.fyicenter.com/article/