Press "Enter" to skip to content

Curated SQL Posts

Types of Window Functions in SQL Server

I have the first of a two-part video up:

In this video, I walk through four categories of window function, plus a somewhat-related type of function in SQL Server. From there, I demonstrate how aggregate window functions and ranking window functions work.

The second part will come out next week and will cover the other types of window function. Otherwise, this was shaping up to be a 40-minute video and that’s a bit too long.

Leave a Comment

Troubleshooting Bulk Insertion in SQL Server

Rick Dobson lays out some common issues:

Most SQL bulk insert and SQL Server openrowset tutorials skip file access issues that can stop imports cold. Both the bulk insert statement and openrowset function rely on the SQL Server service account to read a source file. The SQL Server service account must have read permission on the file or its folder. It is also convenient to have read & execute as well as list folder content permissions. Also, non-standard source file locations (e.g., C:\Users\Public\Downloads) may not grant default read access to the SQL Server service account – always verify before use.

Click through for several recommendations, links to additional resources, and a few scripts along the way.

Leave a Comment

Using Sankey Diagrams in Power BI

Ben Richardson creates a visual:

Ever wished you could see exactly how customers move through your sales funnel, or how costs flow across your business?

A Sankey Diagram makes those flows visible, showing not just totals but how values split and connect between categories.

In Power BI, the Sankey Diagram is available as a custom visual from AppSource, designed to reveal relationships and flow patterns.

There are specific times and places for Sankey charts. It requires having a natural flow in your data—that is, you need different states of data, those states should typically only “move” in one direction, you have paths to get from one state to another, and there is enough variety in pathing that not all of the data is going to the same location. The more of these rules you violate, the less useful a Sankey diagram is.

Leave a Comment

Calendar-Based Time Intelligence in DAX

Marco Russo and Alberto Ferrari grab a calendar:

Since its first release in 2010, DAX has had a set of time intelligence functions to simplify calculations like year-to-date, year-over-year, and so on. However, the calculations only supported the Gregorian calendar, without addressing similar requirements for other calendars, such as the 4-4-5, ISO, and many other non-Gregorian calendars. With the classic time intelligence, the columns of the Date table were unknown to the time intelligence functions, with the only exception of the date column in the Date table, typically Date[Date].

Click through to see what Marco and Alberto have come up with.

Leave a Comment

Installing Older PowerShell Modules with Dependencies

Andy Levy needs an older version of dbatools:

I don’t recall where this came up (probably in SQLSlack), but I had a need to install an older version of dbatools to test something related to loading the dbatools.library library/dependency.

Read on to see how Install-Module won’t quite cut it because it doesn’t bring in the older versions of dependencies. But there is an alternative.

Leave a Comment

SQL Server 2025 RC1 Released

Microsoft has a new release candidate:

Currently SQL Server 2025 (17.x) Preview includes features available through release candidate (RC) 1.

In addition to features announced previously, RC 1:

  • Fixes known issues that were present in previous preview releases.
  • Introduces feature improvements.

Click through for the changes. There aren’t a huge number of updates in this candidate, and it came out a bit quicker than I thought it would, with RC0 dropping on August 25th. Given that Ignite isn’t until November 18th, that does still give a fair amount of time for an RC2 to come out, and it’ll be interesting to see if they go that long or release SQL Server 2025 RTM earlier than Ignite.

Leave a Comment

Building Lists in Markdown

Mike Robbins has a list and checks it twice:

In Part 1: Getting Started with Markdown for Technical Writers, I introduced the basics of Markdown, including how to format both ordered and unordered lists. This article builds upon that foundation, providing everything you need to know about using lists in Markdown, from basic syntax to advanced formatting techniques.

As a technical writer, understanding how and why to use lists in Markdown isn’t just about syntax. It’s about clarity, structure, accessibility, and intent.

Read on to see how to create ordered and unordered lists, as well as several tips around when to use each and appropriate nesting of lists.

Leave a Comment

User-Defined Functions in DAX

Marco Russo and Alberto Ferrari look at a new feature in DAX:

Although DAX is a functional language, it did not previously offer the option to let users define their own functions. Starting from the September 2025 version, it is possible to define functions, which are parametrized expressions that can be reused throughout the entire semantic model. This article explains how the functions work. Watch the related video to see the user interface for defining functions.

Click through for more information, and also check out SQLBI’s DAX Lib website for a few examples of the types of user-defined functions you can create.

Leave a Comment

A Primer on Memory-Optimized Tables in SQL Server

Rich Benner builds a table:

A lot of people have heard of in-memory/memory-optimized tables in SQL Server. In our experience, however, not many people are using this feature (which first appeared in SQL Server 2014) in their production environments. This introduction will explain what in-memory tables are and how to use them effectively. This post should help guide your decision about using this feature in your production environment.

For the demos below I’m using the Stack Overflow database, you can go grab a copy here. It comes in various sizes, and a small one is perfectly acceptable for this test. We’re only going to deal with 100k rows of data. Once we have the database available and attached to a test instance of SQL Server, we have a few things to do.

I would heavily caution people before going down the road of memory-optimized tables in a user database. The primary benefit is typically not read speed, but rather write speed. There are also so many restrictions around what you are allowed to do, especially if you want to take advantage of memory-optimized stored procedures. IMOLTP puts heavy restrictions on anything involving cross-database querying (and tempdb is a different database, remember!), to the point that I’ve struggled to implement it in brownfield environments. Ultimately, it’s one of those really neat-sounding features that has too many restrictions to be really useful.

Leave a Comment