Categories
SQL

Eliminating Bad Code Smells with Indexing Computed Columns

Bad code smells can run through a system, and one instance can quickly spread when code is recycled. Simon recently looked at a non-sargable example and was able to fix it by using an index and refactoring the query. I wanted to consider an alternative approach if we saw the same issue repeated consistently. We don’t want to […]

Categories
SSIS

Solving 2 Common Errors with the Azure Feature Pack

Last week we looked at using the Azure Feature Pack for SSIS to interface with Azure Storage. Today we’re going to solve a couple of the common issues I’ve seen when using this pack. Bad or timed out requests You can set up a connection to the storage and it tests fine, but when you come to […]

Categories
SSIS

Connecting SSIS Packages to Azure Storage

Migrating to the cloud can be disruptive to existing processes. Moving storage to Azure isn’t a simple configuration change for SSIS packages. SSIS doesn’t have native connections for Azure. That doesn’t mean we need to completely re-engineer the process or change technology though. How can we take the simple package below and move to using […]

Categories
Misc

Sus SQL

For this week’s short post I’ve been inspired by Reddit. There’s something a little sus with this snippet of SQL: The result? ඞ A very simplistic way to produce an illustration. Not quite as complex as other ways to create imagery with SQL Server…

Categories
SQL Server

Using External References with Data-Tier Applications

One method for transferring a database to a different environment is using a Data-Tier Application – in the form of a DACPAC (for schema) or BACPAC (for schema and data). Trying to use this approach with multi-database solutions is a challenge though as Data-Tier Applications don’t play nicely with cross-database objects. Let’s look at how we can […]

Categories
SQL

Basic Table Metrics

In Management Studio we can view object details by hitting F7 in Object Explorer. It gives us basic metrics but I find it very slow to load for the details I typically need. For that reason I though I’d share a script to turn to for metrics I commonly need. This query returns: Results for the AdventureWorks2022 […]

Categories
SQL

Searching with Wildcard Characters

Performing a wildcard search by throwing a % into a LIKE expression is bread and butter. How do we handle this when we actually want to search for the wildcard though? This was an issue I first saw early in my career before I was even building database solutions. The business had a back office solution where you could […]

Categories
Personal

Out of the Office

I’m currently out of the office, not quite as pictured unfortunately. I’ve had quite a bit recently – for better or worse. But that’s not why we’re here. I do have a pet peeve though, and I’m sure we’ve all seen it before: Then you take a look at their profile, and it’s just as […]

Categories
SQL Server

Creating a Role for Proc Execution

We have database roles for reading and writing data but interestingly there’s no role which provides permission to execute procedures. Most DBAs I’ve worked with – production or development – prefer to use stored procedures for data access rather than an ORM. A role to allow procedure execution would be very handy. So let’s fix […]

Categories
Azure

Retaining Directory Structure in Azure Blob Storage

A hierarchy of directories which contain files. That’s how we typically think about file storage. That’s not quite the same everywhere. In Blob Storage a file can appear to be in a directory, but when it’s removed so is the directory. This can occur when using Lifecycle Management to help purge legacy blobs, which can […]