Press "Enter" to skip to content

Author: Kevin Feasel

Identify SQL Server Configuration Drift

Garry Bargsley won’t let the cattle become pets:

As you sit and wonder about when the next Star Wars movie is going to come out, do you ever get the thought of “I wonder if all my SQL Servers are configured the same?”

Occasionally, I get a thought like that run through my mind. Or I might see something on Twitter or Blog post about something, and it sparks the question.  Not about Star Wars, but my SQL Server environment.

Today something triggered me to confirm that all of my SQL Servers had the default backup compression setting set to enabled.

Garry mentions dbachecks at the end, and it’s a really good way of performing a fairly large number of such checks easily.

Comments closed

Filtering Unique Objects in Powershell

Jeffrey Hicks solves an interesting problem:

A few weeks ago my friend, Gladys Kravitz, was lamenting about a challenge related to filtering for unique objects. PowerShell has a Get-Unique cmdlet, and Select-Object has a -Unique parameter, but these options are limited. On one hand, I’d say most things we manage with PowerShell are guaranteed to be unique. Objects might have a GUID , ID, or SID, to guarantee uniqueness. But, and this is Gladys’ situation, sometimes the things we are managing come from an external source. Such as importing data from a CSV file. In this situation, it is definitely possible to have duplicate objects.

This turns out to be a bit harder than expected.

Comments closed

Reviewing the ConstantCare Population Report

Brent Ozar surveys the landscape:

Ever wonder how fast people are adopting new versions of SQL Server, or what’s “normal” out there for SQL Server adoption rates, hardware sizes, or numbers of databases? Let’s find out in the summer 2021 version of our SQL ConstantCare® population report.

Click through for Brent’s findings. It’s interesting to compare these against Steve Stedman’s findings, and these come with the same caveat about population.

Comments closed

Buffering Events in SQL Server

Eitan Blumin has a technique to reduce expensive upserts:

Do you find yourself facing performance problems and long lock chains caused by very frequent INSERT, UPDATE, or DELETE statements being executed on a table? Check out this neat trick that could help you out and make all the difference in the world.

Okay, I admit that title ended up being quite long. But I wanted something that could be easily found in search engines by people facing similar problems.

I’ve done something similar, though without the partition switch and instead deleting batches into a temp table. This is a good example of something I like to say about scalable processes in T-SQL: many times, the most scalable technique involves a mental pivot (and sometimes a literal pivot, such as using tally tables to work with string data) of the straightforward answer.

1 Comment

Ending Mainstream Support for SQL Server 2016

Allan Hirt gives us the skinny:

Today is July 13, 2021. Besides the anniversary of Live Aid in 1985 (had to sneak a music reference in somewhere!), today marks an important date: the end of mainstream support for SQL Server 2016The last Cumulative Update was CU17 released on March 29, 2021. UPDATE: Thanks to Glenn Berry (Twitter | Blog), he pointed out that Microsoft announced that SQL Server 2016 Service Pack 3 is coming around September 2021 give or take.

Windows Server 2016 is on a similar trajectory. It is out of mainstream support on January 11, 2022 – less than six months from now.

What does this mean for you?

Read on to learn what it means.

Comments closed

Fun with Containers

Barney Lawrence has some fun with containers, starting with running SQL Server and ending with something a little more entertaining:

Many of you out there may, like me, find yourselves sharing a home with a miniature Minecraft Addict. I do and in between showing off her latest builds she’s begun pestering me to find a way to play with friends and family. I figured I could maybe save some work and re-use my newfound containerised powers for fun as well as profit and a few quick searches proved me right.

Click through for more.

Comments closed

OpenSearch 1.0 Released

Andrew Hopp, et al, announce version 1.0 of OpenSearch:

OpenSearch is a community-driven, open source search and analytics suite derived from Apache 2.0 licensed Elasticsearch 7.10.2 & Kibana 7.10.2. It consists of a search engine daemon (OpenSearch), a visualization and user interface (OpenSearch Dashboards), and advanced features from Open Distro for Elasticsearch like security, alerting, anomaly detection and more.

Click through for the full rundown.

Comments closed

Fun with Powershell Strings

Robert Cain shows off some features around strings in Powershell:

PowerShell has some of the best, most flexible string handling of any language I’ve used. In this post we’ll look at some string basics, then some of the features that make it special.

Note in these demos I’m using PowerShell Core 7.1.3 and VSCode. Everything here should also work in the PowerShell 5.1 and the PowerShell IDE.

Read on for types of strings, embedded quotations, string interpolation, and more.

Comments closed

Removing Comments from Code with T-SQL

Tomaz Kastrun is not pleased with these comments:

This procedure will strip all the comments from your T-SQL query and return only the parts, that are uncommented.

Procedure is able to detect and remove the following type of comments (regardless of the position of the code or comment):

– in-line comment ( — comments )

– multiline comment (Slash star /* comments)

– in-line comment block

– comment within a comment (multiline block)

Read on to learn how.

Comments closed

String Splitting with Line Numbers using CTEs

Steve Stedman has an interesting use for common table expressions:

Years ago while working on my CTE presentation for a SQL Saturday I added a blog post called “Using a CTE to Split a String Into Rows“, and since that posting I have used it many times.   But as things go in development, eventually there is a need to do something more.

Doing some complex string building to create files lately I cam across the need to use a CTE to split strings into rows but to also include line numbers.  To accomplish that I first started with the same function that I used last year, but renamed it, and added a second output column called LineNumber, here is what it looked like:

Click through for the script, as well as some additional notes.

Comments closed