Category: Blog

  • The SUM of Nothing: #SQLNewBlogger

    I caught this interesting item over on Pinal Dave’s blog: Eleven Interview Questions that Look Too Easy. I decided to give you a few thoughts from me on the SUM one.

    Another post for me that is simple and hopefully serves as an example for people trying to get blogging as #SQLNewBloggers.

    The Sum of Nothing

    I am guessing more people working with SQL know that if you have a NULL in your data and try to sum the column, you get the NULL ignore. After all, you can’t sum up values if one is unknown. The code and query below show this:

    2026-09_0133

    Note, with ANSI_WARNINGS I get a note in the Messages tab:

    2026-09_0134

    However, what if there are no rows? Would you expect a 0, because if there isn’t any data, the sum is zero, correct?

    No.

    2026-09_0136

    Why? The docs don’t mention this (I’ve added a PR).  The ANSI standard notes that if all values are NULL or the set is empty, NULL is returned.

    Most of us don’t query empty tables, but we could get an empty set. Remember, the column list, and therefore aggregate, is evaluated after the WHERE and JOIN clauses. Therefore, as you see below, I could get a NULL in a sum where I expect data.

    2026-09_0135

    Make sure you account for this in your queries.

    SQL New Blogger

    I read reading another blog (Pinal’s) and realized this was interesting. I thought about if I’d have a problem and realized that I could because I’ve often assumed there is some data, but if I let users filter data from an app, I could return NULL.

    Easy to write, about 15 minutes to setup and do. You could do this.

  • Architecting Zero Downtime Deployments–Day of Data Boston

    Here are the resources for my talk at Day of Data Boston.

    Slides – ArchitectingZeroDowntime.pptx Slides also at: https://dayofdata.org/2026-10-03-dayofdata1150/#schedule

    Code: https://github.com/way0utwest/ZeroDowntime

    Book: Refactoring Databases

    Some interesting questions. I’ll write more, but a couple of quick answers as I breakfast at Logan.

    How do I handle expanding a column? Making it larger?

    This is platform and change dependent. For example, if you are expanding a varchar() column from 10 to 20, this is usually a metadata operation in MSSQL. No data gets touched, no rows, the system tables record a new size. This can be instantaneous. There are exceptions where this might take time, but usually this works.

    Changing from int to Bigint is different, but I’d follow the split columns pattern and add a new column instead, move data, then drop the old one.

    How do I get my organization to adopt better patters?

    This deserves a longer answer, but there are two parts: technical and politicial. The technical part is teaching other developers the new patters, using linting to catch issues, and convincing others this isn’t hard and works well.

    The political part is getting management to support/enforce this. That can be tricky, but you need to provide business reasons why downtime is a problem and how this addresses the issues, with real numbers: time down, cost savings, revenue lost, etc.

  • The Book of Redgate:A Prehistory

    I’ve covered the values in a number of previous posts on the Book of Redgate. Those values came from our founders, Simon Galbraith and Neil Davidson. I am lucky enough, and honored to have known these gentlemen for many years and had the chance to sit and chat with them throughout my time at Redgate. Simon and I still get together periodically even today after 25 years.

    In the Book of Redgate, there’s a section about prehistory. In it, there’s this picture and text. Neil and Simon have known each other since they were sixteen, starting a business together after they spent time at university.

    2026-07_0415

    Neil stepped away from the company many years ago, for a variety of reasons, and he remained on the board for many years. Simon continued as CEO for a long time and stepped down right after the pandemic. He remains on the board today.

    The thing that caught my eye is that they worked together from their 20s until their 40s. I still remember their joint 40th birthday party at the old Redgate office. How many people have you worked with for 20 years?

    How many of you have worked for an organization for 20 years?

    I guess I’ve worked for SQL Server Central for 25 years, but only some of those were me working for myself. I’ve been with Redgate almost 20 years as a contractor and employee, but I haven’t spent 20 years with anyone outside of my family and Andy Warren.

    He and I still talk most weeks, even though we’re not in business together anymore.

    Redgate has remained a strong brand and presence in my life and that of many others. Part of that is the longevity of so many employees. We’ve had some ups and downs, but relatively few turnover over the years. More recently, especially in sales, but there are a lot of people who have worked there for more than 10 years.

    That’s still amazing to me.

    I have a copy of the Book of Redgate from 2010. This was a book we produced internally about the company after 10 years in existence. At that time, I’d been there for about 3 years, and it was interesting to learn a some things about the company. This series of posts looks back at the Book of Redgate 15 years later.

  • Keeping Track of my ConEmu CLIs

    I use ConEmu for my terminal interface. I’m still on Windows 10 at home, and for consistency’s sake, I run this on my Win11 laptop and the home machine. I love it, and it keeps my windows together, so that I can run multiple command prompts.

    However.

    Sometimes I find myself in this situation. I have a bunch of prompts open, and I’m not sure what is what. I know the current one is one of my Flyway projects, but what about the other 4?

    2026-09_0129

    I was flipping through them recently and thought there has to be a better way. As you can see, some have a folder, but some don’t. What I really want is some organization.

    I learned I can right click the header and get a menu. Notice the “rename” in here.

    2026-09_0130

    I can type a new name then for the tab. I did this for my last (right-most) tab below:

    2026-09_0131

    Now I can see where all my tabs are focused. I’ve had a tendency to pop a new tab for a new task, as I sometimes have different things going on as I multi-task, or really, as I wait for someone to respond so I can complete the task in a window.

    2026-09_0132

    I wish I had an auto-mapping of some sort that might rename these for certain things, but this works well for now. I usually only have 4-5 open, and if I change the task, it’s easy to rename a tab. I tend to do that when I realize I’m looking for something and the name is wrong.

    If you use the Windows 11 terminal, it can run multiple prompt and you can rename them as well, but if you’re still on W10 or lower, think about ConEmu. I’ve loved it for the last 5-6 years and it’s worked well. Plus I can have it slide down from the top if I want.