A New Word: Dead Reckoning

dead reckoning– v. intr. finding yourself bothered by somebody’s death more than you would have expected, even if they were only an abstract presence in your life, like a lighthouse in the distance that suddenly goes dark, leaving you with one less landmark to navigate by.

I hope many of you don’t deal with death too often, though as you age, this is one of the worst things about living longer. You see more people die.

It sucks. Every time I update sqlmemorial.org, I’m sad.

It’s been surprising to me how often I feel dead reckoning, sometimes after someone I don’t even know personally dies. Prince affected me that way, and every time I hear a song from him I feel more sadness and loss than I would have expected.

I hope you don’t experience this a lot, but the more you live life and engage with others, the more likely it this is something with which you have to cope.

From the Dictionary of Obscure Sorrows

Posted in Blog | Tagged , | Leave a comment

Finding the Last Last Name in SQL: #SQLNewBlogger

I wrote a piece on the new SUBSTRING in SQL Server 2025 and got asked a question. How do we get the last last name, such as only getting “Paolino” from “Miguel Angel Paolino”. This post will show how you can easily do this.

Another post for me that is simple and hopefully serves as an example for people trying to get blogging as #SQLNewBloggers.

The Scenario

I have a set of names, like those in the Northwind.dbo.Customers table. I want to find the last names only, perhaps for a mailing, or maybe for a search box. I have names like these:

2025-11_0155

Notice line 80 above. There are three names here. In the US, we might consider this as a first, middle, and last names. In Spain, however, this might be a first name and two surnames. If I only wanted the last last name (Paolino), how can I get that?

One of the cool things about working with strings is that we can look at them a few ways, and we have a great T-SQL function that can help: REVERSE(). The last last name is really the first name in a reversed string.

Backwards, but we can fix that.

Let me build up a query. First, I’ll get the ContactName and then the First Name. I’ll use the Charindex to find a space and then assume everything before the space is the first name. That gives me this code:

SELECT
        ContactName,
        SUBSTRING(ContactName, 1, CHARINDEX(' ', ContactName)) AS ContactFirstName
FROM dbo.Customers;

And these results. Notice I have the first names. This isn’t perfect, but it’s often works.

2025-11_0157

Now, let’s add the string reversed.

SELECT
        ContactName,
        SUBSTRING(ContactName, 1, CHARINDEX(' ', ContactName)) AS ContactFirstName,
        REVERSE(ContactName) AS ReversedName
FROM dbo.Customers;

The results are interesting. Look at lines 79 and 80. The first name is the first word before a space. For the last name, it’s the first word before a space, but reversed. The first part of 79 is shpesoJ and the first part of 80 is oniloaP.

So let’s repeat our substring on the reversed string. Here’s new code:

SELECT
        ContactName,
        SUBSTRING(ContactName, 1, CHARINDEX(' ', ContactName)) AS ContactFirstName,
        SUBSTRING(REVERSE(ContactName), 1, CHARINDEX(' ', REVERSE(ContactName))) AS ReversedLastName
FROM dbo.Customers;

And look at the results. now my third column is the last name, just backwards.

2025-11_0159

Now we can wrap that last column in another REVERSE() and we get the results we want.

2025-11_0160

SQL New Blogger

This is a common type of task, and one that you might be asked in an interview, or as a part of a spec. This post only took about 10 minutes to write, with code, and if this were on your blog, I bet an interviewer would ask you how to do this.

Try to influence the interview and write your own post. Do some testing on performance as well, explore how to work with T-SQL to become better at it and showcase this to your next hiring manager.

Posted in Blog | Tagged , , | 4 Comments

SQL Server 2025 GAs Today

If you aren’t watching the Ignite keynotes today, then you might have missed the announcement that SQL Server 2025 officially releases today. The main SQL Server page gives you a place to get some marketing info, while the docs should change to remove “preview” today.

I’ll have some thoughts later in the week, but this has been a low key release for me. While I’ve been hearing about different features, both publicly and under my MVP NDA, there hasn’t seemed to be a lot of people excited about the release.

That makes some sense as the product is very mature, and most of us use the core features, which sometimes get improvements in new versions, and sometimes regressions.

In any case, as I look through the What’s New, there is a lot of stuff changing, and a lot of additions. I always like the T-SQL language changes, and with so many people using JSON these days, having more functions to work with these strings is important. Regex is meh for me, but fuzzy string matching is interesting.

SSMS v22 also goes GA today, and I hope it’s more stable than the preview has been. I’ve tried the GitHub Copilot in here, and I keep seeing freezes in the app. However, I also think this is a feature that will get a lot of data professionals experimenting with AI. Of course, if you have SQL Prompt, I’d suggest you try it there first.

The big thing that I’d have appreciated in a lot of jobs, and I think a number of customers will like is a Standard Edition version of Developer Edition. That prevents mistakes where devs read about something on SQL Server Central or elsewhere and then implement it in dev, without realizing it won’t work in their production Standard Edition version.

I don’t know how excited many of you are to use this version, but it’s the latest one and starts the clock on 10 years of support for security fixes. We’ve had a few lately, so at this point, if I were upgrading an older instance, SQL Server 2025 is where I’d go. Especially now that Standard Edition can run with 256GB of RAM. That alone might get me to upgrade some older SE instances.

Posted in Blog | Tagged , | 4 Comments

The Roundup for T-SQL Tuesday #192

Last week I asked you to write about SQL Server 2025 and what things you might be looking forward to in the new version.

First, as usual, is Rob Farley. He has an advantage, being in Australia, so his day starts earlier than most. His post this month is on string matching, and he is sad that Master Data Services is leaving in 2025. I’m not sure many people used it, but I also don’t know it was worth removing. However, there are new functions for fuzzy string matching, which are some options for helping with data quality.

Chad write about something I’ve been asking Microsoft about for years. We are finally getting a Standard Edition version of Developer Edition. Chad writes in more detail about this and how to install it.

Deborah writes about two features: optimized locking and ADR. Performance is always on the mind of most people who work with databases, and these two features should help improve performance.

Andy has written on a few AI things in SQL Server 2025, so I expected more. However, I got an AG enhancement I wasn’t aware of that is coming.

Rob in New Zealand writes about security changes in SQL Server 2025, but also notes that the Copilot Integration in SSMS 22 is really what he is looking forward to working with.

My own post was on the backup changes, letting me backup on all replicas.

Louis writes about regex. I was expecting more people to choose this, but glad Louis did.

Glad to see a few people participating. If I missed you, please send me a note with the link.

Posted in Blog | Tagged , | 5 Comments