Press "Enter" to skip to content

Curated SQL Posts

Solving the Jug Problem with Bezout’s Identity

Tomaz Kastrun shifts liquids:

With DFS we can solve this with Bezout’s identity; which in general is a theorem which relates two arbitraty integers with their greatests common divisor; and used in algebraic language, finding common zeros of n-polznomials in n-indeterminates. So the common zeros equals the product of the degrees of the polynomials.

The idea, to refresh your memory, is that you have three jugs of different sizes. Tomaz uses 16L, 11L, and 7L. Using just those, how can you get 8L into each of the two larger jugs? Click through for the answer.

Leave a Comment

Securing SQL Server Maintenance Tasks

Fabiano Amorim shares some advice:

SQL Server is often marketed or perceived as secure by default, but real-world testing shows that default installations and default permissions still expose several attack surfaces. With this in mind, “secure by default” does not mean “safe without review.” 

Many risks come from legacy behavior, backward compatibility, broad permissions granted to the public role, system procedures, implicit trust boundaries, and administrative convenience features. 

The risk appears when they are combined: a database user with more permissions than necessary, a maintenance job running as a highly privileged owner, an unexpected trigger, or an impersonated module that changes how permissions are evaluated. 

Click through for a depiction of how the attack path works and things you can do to prevent systems compromise.

Leave a Comment

Thoughts on Fabric User Data Functions

Jon Lunn shares some thoughts:

Fabric User Data Functions are a bit of a strange hybrid. They can be used like Azure Functions, to call some code outside and act like a serverless compute function, but also can extend notebooks as a source of reusable data logic. I’ve been using them since preview, and now they support Azure Key Vault (AKV) and Fabric Variable Libraries, I think they are ready (mostly) for productionable use.

I think the part that annoys me the most about them is that they’re called “User Data Functions” instead of “User-Defined Functions” and yet the acronym is the same.

Leave a Comment

MSDB 110_upgrade.sql Failed with Error 574

Jordan Boich troubleshoots an issue:

SQL Server won’t start and at first, I couldn’t figure out why. When I logged off for the day on Friday, everything was happy, but when I logged on Monday morning, a heavily used test instance of SQL was not running and wouldn’t start.

Quick side note, and it’s funny looking back on now, but in the moment it sucks. You ever have to start the SQL Server Service from Configuration Manager, and when you right click -> Start, or right click -> Restart you see that green progress bar start to go and under normal healthy circumstances, it probably gets a third of the way through before SQL kicks over. But when you start to see that progress bar start to make more and more progress, you know before it even fails on you that something isn’t going to work right. You start to get that sinking feeling in your stomach. That was me.

Click through for the troubleshooting process as well as the end result.

Leave a Comment

Shrinking Power BI Datasets via Parameter Filtering

Andy Brownsword’s appeal is becoming more selective:

When developing Power BI models, we don’t always want to refresh the entire dataset before we start working with the data. We can speed up the refresh – and therefore our development – by reducing the volume we’re working with.

Here we’ll look at a couple of ways to use parameters to adapt production-ready models to reduce and tailor data volumes for development.

Click through to see how.

Leave a Comment

Querying Shodan from SQL Server

Vlad Drumea makes use of a new procedure in SQL Server 2025:

In this post I’m querying Shodan‘s REST API directly from SQL Server using SQL Server 2025’s sp_invoke_external_rest_endpoint stored procedure.

In my previous post I looked through Shodan for publicly exposed SQL Server instances.
And, at one of the steps, pulled some of the data into SQL Server to get a better sense of the major versions of SQL Server that were out there on the public internet.
At that point I mentioned I would go into the details about that process in a separate post, so here we are.

Click through to see how.

Leave a Comment

Workspace Monitoring in Power BI

Chris Webb monitors Power BI:

This week, in the announcement about support for Fabric Pipelines in Workspace Monitoring, I noticed that it came with an Operations Agent that actively monitors and analyses Pipeline activity. And that got me thinking, since Workspace Monitoring also contains Power BI activity data, why not create an Operations Agent to actively monitor Power BI too?

Read on for a fairly simple demonstration of how it works.

Leave a Comment

Making Use of the Tabular Editor CLI

Eugene Meidinger opens up the command line interface:

The Tabular Editor CLI (TE CLI) is a command-line interface that makes it possible to view, query, build, manage, and test semantic models programmatically. This is different from Tabular Editor 2 or 3, which have a graphical user interface (GUI) and buttons that you click to take actions and make changes. In the CLI, you type and submit te <command> like:

  • te connect to connect to a model
  • te ls to list its contents
  • te vertipaq to run the VertiPaq Analyzer
  • te add Sales/Revenue -t Measure -i "SUM('Sales'[Amount])" --save to add a measure

You can also execute these commands in a pre-written script. This typically happens in the terminal. A terminal can be a standalone application that you open (like the default Windows or Mac terminals) or embedded in an application like VS Code or Cursor where you can see files in an explorer:

Click through for more info on how it works. Tabular Editor CLI will be free for another two months (as of the time of this post), so it’s a good time to see if this makes sense for your use cases.

Leave a Comment

Performance Tuning with Microsoft Fabric Warehouse Query Insights

Koen Verbeeck troubleshoots query performance:

We are in the process of building a data warehouse in Microsoft Fabric. Since we have good knowledge of T-SQL, we are using Fabric Warehouse as the database engine. We are hitting some performance issues in our ETL and we would like to investigate further, but traditional SQL Server DMVs don’t give the results we are hoping for. How can we troubleshoot performance in the Fabric Warehouse?

Click through to see how.

Leave a Comment