r/SQL • u/Appropriate-Run-7005 • 16d ago
SQL Server NORAD tracks Santa. I built a tracker for the villain trying to cancel Christmas, in SQL with geometry and geography
Every year NORAD tracks Santa. Nobody tracks the opposition, so I did.
The villain is AI Scrooge. He thinks Christmas is wildly inefficient. One man, one sleigh, one night, two billion deliveries and no KPIs. He boots up in a data centre in Slough and spends December trying to fix it.
Stick with me - this does get better...
It doesn't go well. Every day he has a plan, and every day it fails:
On Christmas Eve it turns into a proper tracker. Santa leaves the North Pole and hits each city at its local midnight. AI Scrooge leaves 40 minutes later and spends the whole night 40 minutes behind.
The SQL bit
Each day of the advent calendar has a small script that acts out that day's joke, and every one runs on its own in tempdb on SQL Server 2025. No setup, no sample database. Paste it into SSMS, press F5, and look at the Spatial results tab.
* The drone geofence is STIntersects and STDifference.
* The fake Edinburgh reviews get caught by a polygon around the market, because they came from nowhere near it.
* The elves' union vote draws its picket line with ConvexHullAggregate.
* The chase is great-circle interpolation done in T-SQL.
* Boxing Day is STWithin: does the dachshund fit in the box? Stretched out, no. Curled up, yes.
Tracker (doors open from 1 December, or use the sneak preview because we are not all 5 years old): https://sqlartist.github.io/ai-scrooge-tracker/
There's also a three-minute cartoon of the whole story, and that's T-SQL too. Every character is a puppet made of geometry parts pinned together; every movement is a row in a keyframe table, and a stored procedure moves the shapes for each frame. Each scene has a checkbox that shows the SQL running beside it.
The animated cartoon, seven scenes created for SQL Server 2025: https://sqlartist.github.io/ai-scrooge-film/
Happy to answer questions about the spatial side. Bah, hum-bug.
