Press "Enter" to skip to content

Curated SQL Posts

Tips for Better Graphs

Cole Nussbaumer Knaflic shares a couple recommendations:

When creating a graph to explain something to someone else, I recommend that you declutter and focus attention. These concepts are not new. We have taught and written about them—directly and indirectly—many times before. I wrote about them again when drafting my new book, but then decided to take a different approach. Rather than relinquish my original words to a dismal fate in my computer’s trash bin, I thought perhaps they might still be of use here. After all, even if we’ve shared good advice before, sometimes it bears repeating.

Those are great general principles and Cole has specific examples of the principles in action.

Comments closed

Change Data Capture in Azure SQL Database

Abhiman Tiwari announces that CDC has gone GA:

CDC is now generally available on Azure SQL databases, enabling customers to track insert / update / delete data changes on their Azure SQL Database tables. On Azure SQL database, CDC offers a similar functionality to SQL Server and Azure SQL Managed Instance, providing a scheduler which automatically runs change capture and cleanup processes on the change tables. These capture and cleanup processes used to be run as SQL Server Agent jobs on SQL Server on premises and on Azure SQL Managed Instance, but now they run automatically through the scheduler in Azure SQL databases. Customers can still run scans and cleanup manually on demand.

Looks like it works pretty much the same as on-premises SQL Server, so it’s got that going for it.

Comments closed

Deploying an Azure Function via Azure DevOps

Koen Verbeeck wants to deploy a Powershell-based Azure Function:

In the blog post Azure Function with PowerShell and the Power BI REST API I explained how you could create an Azure Function using the PowerShell scripting language. This Function connected with the Power BI REST API and retrieved the last refresh status of a dataset. Developing the Function is one thing, deploying it is another. In this blog post I’ll guide you through the set-up of a build and release pipeline in Azure Devops. As a prerequisite, the Azure Function and its dependencies (for example the requirements.psd1 file) are all checked into a Git repo. As a reminder, the folder structure looks like this:

Read on for the walkthrough.

Comments closed

Binding a “Preview” Shortcut in SSMS

Daniel Hutmacher previews a table with a keyboard shortcut:

On the surface, these query shortcuts are just what the name implies – a key combination that you can press to run a command or execute a stored procedure. But there’s a hidden super power: whatever text you’ve selected in SSMS when you press the keyboard combination gets appended to the shortcut statement.

That is quite useful, though I’ve already bound all of those SSMS shortcuts to various forms of WhoIsActive.

Comments closed

This Month in Synapse

Ryan Majidimehr recaps the updates for Azure Synapse Analytics in April of 2022:

Since the GA of Synapse, customers have asked for a fine-grained RBAC (role-based access control) role that allows a user persona to monitor the execution of Synapse Pipelines and Spark applications without having the ability to run or cancel the execution of these applications.  

Now, customers can assign the Synapse Monitoring Operator role to such monitoring personas. This allows organizations to stay compliant while having flexibility in the delegation of tasks to individuals or teams. 

That is indeed useful.

Comments closed

Simplifying T-SQL Code

Ed Pollack shares several good T-SQL tips to simplify code:

While trying to solve the data challenges an organization throws our way, it is often easy to get buried in large, complex queries. Despite efforts to write concise, easy to read, maintainable T-SQL, sometimes the need to just get a data set quickly results in scary code that is better off avoided rather than committed.

This article dives into a handful of query patterns that can be useful when attempting to simplify messy code and can both improve query performance while improving maintainability at the same time!

Click through to learn more. I use most of those tips to great effect (though don’t often have need to hit some of the DMVs Ed mentions).

Comments closed

A Power BI Report for Power BI Report Access

Gilbert Quevauvilliers sets up an infinite loop:

In this blog post I show the final part which is how I created the Power BI report which takes the previous 3 steps and then creates the Power BI Report.

I am going to show you how I got the data in using Power Query and then created the Power BI report.

Read on for the process. But now I want a report to see who has access to the report for who has access to reports. And I think I need a report for that layer. And that layer. And…

(Shh, yes, I know you can get that all from the same report but it’s so rare I get to make a “Turtles the whole way down” reference).

Comments closed

The KQL where Operator

Robert Cain continues a series on KQL:

In my previous post, we saw how the search operator was used to limit the results of a query. This post will focus on the where operator, which performs a similar function.

Whereas search is used to limit based on matching of a string, the where operator is used to match based on a condition. In this post we’ll see some of the conditions that can be used with a where operator to narrow down a dataset.

Read on for plenty of uses of the operator.

Comments closed

Calculations in DAX with CALCULATE()

Marco Russo and Alberto Ferrari explain one of the most important DAX functions:

CALCULATE, with its companion function CALCULATETABLE, is the only function in DAX that can change the filter context. Its use is very intuitive at first, and most DAX developers start using CALCULATE without knowing the most intricate details of its behavior. Then, sooner than later the use of CALCULATE becomes frightening because CALCULATE starts to misbehave. When this happens, it is nothing but a signal that you need to learn more theory and deepen your understanding of the behavior of CALCULATE.

In this article, we do not introduce the most complex behaviors of CALCULATE. Instead, we provide a beginner’s guide to CALCULATE, and we try to avoid making things simpler than they are. CALCULATE is definitely a complex function. Here we introduce its base behaviors, with a solid theoretical foundation.

Definitely a must-read if you work with Power BI and don’t have CALCULATE() down pat.

Comments closed