Projects

Everything I’ve Made SQL Server Do

SQL Server has drawn, played games, pretended to be other computers and made music. This is the index of all of it, and I’ll keep adding to it.

Updated

Why a database

I’ve spent about thirty years with SQL Server. I’ve written books about it, and Microsoft gave me an MVP award for it. For nearly all of that time I used it the way everyone does. Put the data in, get the data out, repeat.

This summer I started asking it to do things it was never meant to do. First a language model. Then Doom, Elite, a bouncing ball and a ZX Spectrum. Then the AS/400 I learnt my trade on, a synthesiser, 1.7 million speeches from Parliament and Feynman’s safes. Just recently, building my own head out of Lego.

People ask why. Other languages do this far better. Well, I didn’t learn all those other languages. I learnt Excel, which ran out of rows, so I learnt SQL. It’s as simple as that. I talk about it in more detail in the articles.

I chose the games because they were groundbreaking when they came out. Seeing the Amiga bouncing ball for the first time blew me away, and memories like that are what made many of us choose this as a career. I wanted other people to feel what we all felt when we first saw them.

It turns out it’s just as I believed. SQL Server is the database I’ve used my entire career, and its developers and technical community are by far the most professional, smart, open and supportive group of people I’ve seen anywhere in the world.

The rules

Every project was meant to follow some basic rules. I’m not that obsessive, but they do let me show where it works and where it clearly doesn’t. The hardest thing for me was admitting defeat and using PostGIS, because SQL Server just doesn’t have the features and Microsoft seemed to stop developing them in 2013. The rules were there to make me finish the Doom article.

  1. The database is the machine. Memory is a table. The CPU is a stored procedure. The display is a join. The heavy lifting happens in T-SQL.
  2. The client is just a window. PowerShell or a bit of Python shows the frame and passes the keypresses back. It doesn’t do the thinking.
  3. It runs on a real instance. Mine. Every result in these articles came off my own SQL Server, errors and all.
  4. Sets first, loops only when I have to. I only reach for a loop when the problem really is sequential. Knowing where that line falls turned out to be the whole game.

Games

Doom

Actual Doom — real WAD, real BSP, real E1M1 — rendered by a relational database. A WAD file is already a relational database, the BSP tree is a recursive CTE, and Doom’s clipping is a window function. About three frames a second at 320×200, on an ordinary desktop instance. I got it there from 0.7 frames a second, eventually.

First written up 13 Aug 2026

Elite

Elite is a database wearing a spaceship costume, and we like databases. 31 ship blueprints parsed from annotated 6502 source, 8 galaxies and 2,048 systems from three 16-bit numbers, and a flight model with combat and docking against a rotating station. A real Elite frame takes 3.51ms: four hundred times faster than Doom, because vector graphics are a join and rasterisation isn’t.

First written up 4 Sept 2026

The Amiga Boing ball

When I turned to the Amiga Boing ball, I assumed it’d be the easy one. The entire animation — 64 frames, 320×256, five and a bit million pixels — comes out of one INSERT … SELECT. It was the easy one, right up until I added a second ball and then I wish I hadn’t started. Two balls taught me more than Doom did.

First written up 7 Sept 2026

Other computers

The ZX Spectrum

A 48k Sinclair ZX Spectrum running inside SQL Server 2025, loading “Daley Thompson’s Decathlon” (Ocean, 1984) from its original Micro-drive cartridge. The Z80 core was written by Claude from a Python generator rather than by hand. Forty-three years after Sinclair sold the thing for £175, it’s running inside a relational database, being played by a query. I may be mad to attempt to put a ZX Spectrum into SQL Server, but I’m not crazy enough to rewrite machine code when I don’t have to. My deep brain stimulator would malfunction.

First written up 18 Sept 2026

The AS/400

How a warehouse with the plan upside down taught me everything I know about data and why I’m rebuilding an AS/400 inside SQL Server thirty years later. Then I wrote a bug I had seen before. Putting an AS/400 inside a database isn’t parody. It’s closer to restoration.

First written up 15 Sept 2026

Running 1,000 SQLite Databases Inside SQL Server

A SQLite database is just a single file on disk, and a file is just bytes. What happens if you store a complete, standalone SQLite database inside a VARBINARY(MAX) column in SQL Server, and mount it in memory only when a query asks for it?

First written up 28 Nov 2026

Sound

A synthesiser, a MOD player and a sampler

I wanted to see whether SQL Server itself could produce the sound: every sample, every drum hit, every note, worked out with set-based T-SQL, with Python doing nothing more than passing the bytes to the speakers. The Prodigy will have to wait. But SQL Server can now chop up a breakbeat, pitch the vocal up an octave and play it back through a graphic equaliser.

First written up 27 Sept 2026

Shape and space

My head, in Lego

I took a 3D model of my own head, loaded it into SQL Server and had T-SQL turn it into bricks: 4,149 bricks in 13 colours, designed from start to finish by SQL Server 2025. Then I noticed I’d built myself without a brain, so I built one of those as well. The follow-up is how SQL Server directed a 40-second Lego video without drawing a frame, and what 8,669 bricks cost if you build it for real. The answer to the second question is £1,009, by the way.

First written up 16 Oct 2026

Relational space carving

Here is the complete documentation of how you can turn SQL Server into a crude 3D photogrammetry engine, taking a flat image, mathematically carving it in a database, and outputting a watertight mesh ready for the 3D printer. If a voxel is solid from the front view and solid from the side view on the exact same row, it survives. If not, it is carved away.

First written up 23 Aug 2026

A walkable filesystem

I have around 80 terabytes accumulated over thirty years. The information is preserved but I can’t navigate it, which is as good as losing it, just more expensive. I built a 3D Navigator in SQL Server to allow a virtual walk around your data. You ask a question, and the answer becomes a direction you can walk in.

First written up 19 Aug 2026

Brian the sausage dog

She wants a baby (33), I’m 53 and a dead man walking, so we compromised. We got a dachshund and named him Brian. I wrote a cartoon called “The Dachshund” starring Brian, using SQL Server 2025 Spatial and the Geometry datatype. Keyframes are rows; toon.Render interpolates them, composes the affine transforms down the puppet with a recursive CTE, applies them with sx.Affine and adds a felt-tip “boil” with sx.Jitter.

First written up 3 Oct 2026

Feynman’s safes

This one is Richard Feynman cracking safes at Los Alamos. A million down to eight thousand, and he did it with arithmetic, not a drill. So I went the long way round and built the actual metal in SQL Server 2025’s spatial types. Both halves say the same thing: a real mechanism has slop, and slop leaks information.

First written up 10 Oct 2026

The Watchmaker

I have always wanted to build a watch, so I coded one. This was meant to be about SQL Server 2025, but halfway through I had to pack my bags and move house to PostgreSQL. By the end, a database had designed a 26 mm watch movement of 34 parts, checked that no two parts share space, worked out by itself how to take it apart, and run it for a minute. Then I built the musical pocket watch from For a Few Dollars More in a database, and made it play the tune.

First written up 1 Nov 2026

Close to home

The headache machine

Some people get headaches, some people get migraines; I get Cluster Headaches. About twenty years ago, when they first arrived, I did what any desperate database person does: I built a system. Twenty years on, the tools have finally caught up with the idea: a SQL Server 2025 system that suggests deep brain stimulation (DBS) electrode placement from anatomically similar previous patients and how successful their operations were. All data is simulated.

First written up 1 Oct 2026

What it’s taught me

21 projects in, the same few lessons keep coming back. None of them is really about games.

Wide beats deep.

SQL Server is extraordinary at wide work: do the same thing to five and a bit million pixels at once. It’s terrible at deep work, where every step waits on the one before. Most of these projects came down to the ratio between the two. Emulating a 68000 with a full custom chipset is almost entirely deep work, and that’s where it dies.

The data was already relational.

A WAD file is a set of tables, and so is a tracker module. It took me a while to see that Doom was a relational structure, but Elite was a database from the outset: its galaxy is a space stock system in its rawest form. A surprising amount of old software was a database all along, dressed up as something else.

Approach it as a watchmaker would.

Start with the shapes and sizes of the parts, not the maths behind making a gear. I’m not a maths expert, but I can understand how the shapes fit together because I can take a watch apart. Eventually the maths comes in and explains it. That’s why the animations draw so much interest: you can see what might be happening, then apply the maths needed to recreate it.

Constraints are free testers.

A primary key on the Doom framebuffer turned an invisible bug into a hard error. The original engine never noticed it. On the AS/400 I caught the deletion bug because I’d written a second version whose only job was to disagree with the first.

Check the boring stuff first.

When the music was slow, it wasn’t the maths. It was the commits. When the sound didn’t come out of the speakers, it was going to my headphones. Out of every article or story I’ve written, that was the most embarrassing. Well, apart from thinking that to put one of those BASIC programs on a C15 tape I’d have to type really fast, and I’m only just getting used to typing with two fingers.

Engines will cheat if you let them.

The spelling corrector learnt to delete evidence to lower its own score. On a log-analysis tool. Whatever you’re measuring, something will find a way to game it.

Not SQL, but mine

Not everything I write is about databases.