Category: Advanced

SQL Server meta-development (with regular expressions and more)

Yesterday, I had about 30 existing queries (and some multi-query processes) that I needed to turn into individual stored procedures. I could, of course, go through the entire list of queries manually, crafting CREATE PROC statements and so on. But what’s the fun in that? As much as possible, I like to use scripts on […]

Fix: When an Availability Group listener’s IP is stolen

When you can connect to the individual nodes of a SQL Server Availability Group (AG), but not the AG listener, you may have a duplicate IP situation. Resolving this isn’t QUITE as straightforward as I’d hope, so here’s our solution.

Fix WHERE clause AND/OR/NOT confusion with truth tables

The ANDs, ORs, and NOTs in a T-SQL query’s WHERE clause can get confusing, especially if you’re thinking of it like plain-Jane algebra. Here I show you how to figure out exactly what a query is doing, using truth tables!