Press "Enter" to skip to content

Curated SQL Posts

Dynamically Changing Fabric Data Warehouse SQL Pools

Gilbert Quevauvilliers saves some money:

After reading about the new SQL Pools feature for Warehouses in Fabric, I had an idea, if I could change the SQL Pool configuration based on the expected query load, I could then consume less capacity and have better performance.

https://learn.microsoft.com/en-us/fabric/data-warehouse/custom-sql-pools

Here is an Example I thought of below.

  • When the ETL load is running optimize the SQL pool for writing as typically data is being inserted.
  • After the ETL load and for the rest of the day, almost all queries are read by the Warehouse, so change the SQL pool to be read optimized.

Click through for a Python notebook that does this.

Leave a Comment

Moving from a Named Instance to a Default Instance

Brian Kelley makes a move:

I have a SQL Server named instance that is used by various resources. There may even be reports and other artifacts that access the named instance which we don’t know about. Having a named instance means in a recovery situation we must have a SQL Server installed as a named instance with the same name. This impairs our recoverability as well as our ability to upgrade SQL Server versions because we must retain that named instance. Is there a path to migrate to a default instance without potentially breaking things?

Click through to see how.

Leave a Comment

DDL Modifications and Change Data Capture

Erik Darling has a new video:

So I’ve had to deal with this with some clients recently, and the problem with CDC, of course, is that if you change, add, drop columns from CDC tables, or tables that are covered by CDC, rather, the current change capture table does not reflect those changes. You have to do some work to figure it out. What I’ve got in this video is I’m just going to, a script that I can walk through, I can hit F5 on it.

Click through for the script, information on capture instances, and more.

Leave a Comment

T-SQL Tuesday 201 Round-Up

Jeff Taylor gives us the low-down:

A couple of weeks ago, I asked a simple question with a loaded answer: are temp tables a friend or a foe? The responses did not disappoint. They ran from full-throated defense to a measured “it depends,” and one of you built a lab. That’s what I was looking for.

If there is a consensus, it is this: the reflex is the problem, not the tool. Almost everyone agreed that dumping data into a #temptable out of habit is a mistake. Almost everyone also had a case where a temp table was the right answer, and sometimes the only one. So let’s get into it, in no particular order.

Click through for the cast of characters and what everyone came up with.

Leave a Comment

INFORMATION_SCHEMA and the Fabric Warehouse

Louis Davidson bangs his head against a wall:

When we decided to use T-SQL and a Fabric Data Warehouse for our ETL, I started thinking about generating the code with the metadata in the system catalog views or the INFORMATION_SCHEMA. Having done this sort of thing before in SQL Server over the years, it seemed really straightforward. And it kind of is, until it isn’t.

In this blog I want to show you a few ways you need to understand how working with metadata and temp tables varies (sometimes wildly) from the comfortable SQL Server environment and language you know very well, and give tips on how to get around these differences.

Click through for some of the fun you can have with a distributed SQL Server-like product.

Leave a Comment

Building a Mental Model of LLMs

John Mount puts together an idea:

As of now (late 2026) LLM (large language model) technology providers, users, and work products flood the public commons. It therefore makes sense to have even a primitive mechanistic mental model of these technologies. You are forced to have an opinion. Without a mechanism or model one tends to fall into disempowering anthropomorphic language. Some clear thoughts on this can be found here and here.

In this note I would like to try and outline a (very) simplified mental model of LLM mechanics and mechanisms. By “mental model” I mean a cartoon to work through in your mind, not a model of the LLMs as having their own mind. I won’t be teaching the history of LLMs, how to build them, how to use them, or their moral or philosophic implications. I will only try to give a very rough outline how the current (2026) LLMs work.

Click through for an intuitive explanation of how they work.

Leave a Comment

Waiting for GOdot, SSMS Edition

Tom Zika waits to pass GO:

I deployed a schema change to 30 servers using my deploy-at-low-priority script via SSMS multi-server query. Some of these servers were small with almost no activity, so I expected them to finish within seconds. I opened another multi-server connection to check on progress and none of the small servers showed any sign of having completed. Then all 30 finished at the same time.

Read on to see what happened and why.

Leave a Comment

Azure Arc-Enabled Privilege Escalations

Fabiano Amorim lets us know about a supposed non-issue:

Azure Arc-enabled SQL Server is designed to bring on-premises and multi-cloud SQL Server instances under centralized Azure management, but a newly documented privilege escalation technique shows how that same management workflow can be turned against the server it’s meant to protect.

By combining a database-level DDL trigger with the elevated identity the Azure Arc extension uses during onboarding and configuration, a login with nothing more than db_ddladmin permissions in a single database can escalate to full sysadmin control over the entire SQL Server instance. The result? Complete server compromise.

In this investigative guide, Fabiano Amorim explains how the vulnerability works, how to reproduce it in a lab environment, why Microsoft classified it as Low severity, why that classification is disputed, and what mitigations are available today.

I don’t think this is a “run around with your hair on fire” vulnerability, but I am somewhat disappointed in Microsoft’s response here.

Leave a Comment

When NOLOCK Does Permanent Damage

Aaron Bertrand shares examples:

This is not another “NOLOCK can show you dirty data” rant. There are plenty of posts about that, usually explaining how the hint is a misnomer because it doesn’t really mean “no” locks, how dirty or phantom data can sneak into a report and render it inaccurate, and why RCSI is often a much better solution to reader/writer conflicts.

No, I’ve largely given up trying to swim against the current and fight draconian policies that have taught everyone, far and wide, the commandment:

THOU SHALT USE NOLOCK ON EVERY TABLE REFERENCE.
EVER.
UNTIL THE END OF DAYS.

I don’t know where people learned this, but it certainly feels that way in, well, every place I’ve worked, either as a full-time employee or as a consultant. In each case, it’s been a long road to get them down RCSI, removing NOLOCK, and realizing that things are better.

By the way, I’m glad Aaron included the two non-examples of UPDATE and DELETE with NOLOCK, as I’ve seen cases of this in the wild as well, even though it (thankfully) has zero impact because SQL Server ignores the hint.

Leave a Comment

Optional String Quotes in Stored Procedures

Dualcore DBA learns something new:

Today’s post is a quick one and the first in a new series I am calling “I Was Today Years Old When…” where I share simple little nuggets that I stumbled across where I think “How…HOW have I never known this”

The series for me will serve as a reminder as to why I love working with technology – even if you are working with something you have worked with for many years, every day is a school day, even if the day’s lesson is a small one.

The first “I was today years old when…” is in relation to stored procedure calls in SQL Server.

Click through for the example. Admittedly, I didn’t know this either. Also admittedly, I’m going to go back to forgetting so that I don’t actually use this.

Leave a Comment