sqlserver

Finding & Downloading Required SQL Server Updates

Andy Levy
A little while back, I offered up a one-liner to scan your SQL Server instances and report which ones are out of date. But what if you need to take the next step, determining which updates need to be downloaded? That’s exactly what Josh asked on the SQL Community Slack recently. Can Test-DbaBuild also bring back the KB number? From reading the docs it looks possible as it does return the compliant version form the .

Three Ways to Create a Temp Table

Andy Levy
Taking it back to SQL 101 today because I recently saw something that floored me. I’m a big fan of temp tables. I use ‘em all over the place to stash intermediate results, break a dataset down into more manageable chunks, or even share them between procedures. And as it turns out, there’s more than one way to create them. The Traditional Way If you’re planning out your temp table usage, you’re probably creating them just like any other table, then populating them.

Checking for SQL Server Updates with dbatools

Andy Levy
It turns out I was doing this all wrong for months. For the longest time, I’ve been checking my SQL Server instances to see what needs patching with Test-DbaBuild from the dbatools PowerShell module. But the result was always the same - it never returned a Service Pack or Cumulative Update target. I glossed over it because I knew what the right answer was already, but recently I decided that wasn’t good enough.

User Defined Types and Temp Tables Gotcha

Andy Levy
This tripped me up a few weeks ago, but once I stopped and thought about for a moment it made total sense. I was trying to copy some data into a temp table and got an error I’d never encountered before. Column, parameter, or variable #1: Cannot find data type MyStringType. What’s that all about? Let’s find out. Why User-Defined Types? I’ve never been a fan of user-defined types (UDT). They definitely have applications, but there’s also a temptation to use them to “standardize” things like string lengths or decimal field precision across a whole database.

Modernizing Your T-SQL: Trimming Strings

Andy Levy
This is one of several posts on modernizing T-SQL code with new features and functionality available in SQL Server. Last year, you finally retired the last of your SQL Server 2008R2 instances. Congratulations! But are you taking advantage of everything that your new instances have to offer? Unless you did a review of all of the T-SQL in your applications, I’m guessing not. This one seems pretty basic, but it’s got a trick up its sleeve - the TRIM() function.

T-SQL Tuesday #124 - I'm a Query Store Newbie

Andy Levy
T-SQL Tuesday is a monthly blog party hosted by a different community blogger each month, and this month Tracy Boggiano (blog | twitter) asks us to talk about Query Store, whether we’re using it or not. For this T-SQL Tuesday, write about your experience adopting Query Store, maybe something unique you have seen, or a how your configure you databases, or any customization you done around it, or a story about how it saved the day.

Modernizing Your T-SQL: The Sequence Object

Andy Levy
This is one of several posts on modernizing T-SQL code with new features and functionality available in SQL Server. Last year, you finally retired the last of your SQL Server 2008R2 instances. Congratulations! But are you taking advantage of everything that your new instances have to offer? Unless you did a review of all of the T-SQL in your applications, I’m guessing not. Let’s take a look at the SEQUENCE object, introduced with SQL Server 2012.

Modernizing Your T-SQL: String Aggregation

Andy Levy
This is another in a group of several posts on modernizing T-SQL code with new features and functionality available in SQL Server. SQL Server 2016 gave us the STRING_SPLIT() function, but what about the reverse - compiling a set of values into one delimited string? We only had to wait 15 months for the release of SQL Server 2017, and the STRING_AGG() function. Setup For this post, I’m using the set of North American telephone area codes sourced from the North American Numbering Plan Administrator.

Modernizing Your T-SQL: Splitting Strings

Andy Levy
This is the first of several posts on modernizing T-SQL code with new features and functionality available in SQL Server. Last year, you finally retired the last of your SQL Server 2008R2 instances. Congratulations! But are you taking advantage of everything that your new instances have to offer? Unless you did a review of all of the T-SQL in your applications, I’m guessing not. At one time or another, we all find ourselves having to do some string parsing, especially splitting strings on a delimiter.

T-SQL Tuesday #118 – Your Fantasy SQL Feature

Andy Levy
It’s early September, which means it’s time for T-SQL Tuesday! This month’s topic comes from Kevin Chant (blog | twitter). Our mission, should we choose to accept it (click the image to see the original invite): Recently I’ve had to submit suggestions to Microsoft about Azure DevOps and SQL Server. I will admit a couple of the suggestions had certainly been in my head for a while. In fact, I wish I had suggested them sooner.