If a pile of matchboxes can learn to play Tic-Tac-Toe, then certainly I should be able to code a solution. With my predilection for databases, T-SQL was my tool of choice. But first, I needed to model the game with some sort of data structure. Unfortunately, as I learned, it’s not as simple as mapping some X and O values to a grid.

You might have heard that SQL Server user-defined functions are the devil. That’s because someone got burned. They put a scalar function in a WHERE clause on a big table and fed it a column name. And bad things happened. Continue reading →

One of the many uses of tally tables is to blow up some rows. Normally, you make your database reduce rows by joining tables to others and applying criteria. But sometimes you want it to make more rows. Continue reading →

When talking about bitwise math, I needed to show the inverse of a string of ones and zeros. Instead of doing it manually, I wanted to get a computer assist. Since I always have SQL Server Management Studio open, T-SQL is usually the fastest way for me to use some CPU cycles.

These days, aside from my family and technology, I’m putting most of my energy into learning more about the privileges I enjoy in society and how to dismantle the systems which provide them. Twitter has exposed me to ideas and realities which I’ve never had to face in the past, and it’s frustrating to learn about how stacked the deck is against so many people. That said, except as those issues intersect with technical communities, I’m not ready for this blog to become overtly political. So I’m going to take Aaron’s escape pod and talk about a T-SQL bad habit.Continue reading →