SQL Server 2025 RegEx and AI

One of the language changes in SQL Server 2025 that I’ve seen a lot of people mention is the addition of RegEx functions to T-SQL. I decided to take a few minutes and try to examine how this feature works, and how I might use it. And more importantly, can AI help?

This is part of a series of experiments with AI systems.

Data with a Bit of a Pattern

One of the common things people use Regex for is validating email addresses.

I created a basic table in a database that looks like this:

CREATE TABLE customer
(
     customerid INT NOT NULL
         CONSTRAINT CustomerPK PRIMARY KEY,
     customeremail VARCHAR(200),
     validated TINYINT
)
GO

I then asked PromptAI to get me some test data like this:

2025-11_line0142

I wasn’t connected to a database, but I still got code generated with insert statements. The AI also noted I had a “validated” column, and it populated that appropriately: 1 for good email, 0 for bad ones.

2025-11_line0143 

Once I run the inserts, I have data.

2025-11_line0145

Now, can I check that the AI did this correctly?

REGEXP_LIKE

In SQL Server 2025, there are a number of regular expression functions, and REGEXP_LIKE is one of these. This function is designed to return a boolean if the string_expression matches the pattern_expression, where the latter is the regular expression.

2025-11_line0146

Prompt sees this as a valid function for SQL Server 2025, which is great. I want to use the customeremail from the table as my string to check. For the regex, I need to create a regular expression, something I am not good at doing. I learned to do this at a very rudimentary level when writing Perl, but I’ve lost whatever little skill I used to have.

I saw an expression on StackOverflow for validating email. Let’s check if an AI can help.

2025-11_line0149

In a few seconds, even on airport wi-fi (SFO as I write this), I get a response.

2025-11_line0150

This looks like the expression from the SO answer, though much shorter. If you read SO, you know that the format isn’t as set and stable as we’d like. In any case, let’s see what this shows.

This is interesting. I get an error.

2025-11_line0152

If I look at the docs, this says it returns a true/false, which I’d assume would convert to a 1/0, but let’s try an explicit case. When I do this, it works.

2025-11_line0153

I can also do this in the WHERE clause, where the true/false thing just works. Let me move the function to the WHERE clause. If I do that, I have this code:

SELECT customerid,
        customeremail,
        validated
FROM dbo.customer
WHERE REGEXP_LIKE(customeremail, '^[A-Za-z0-9._%-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}$')

When I run this, I see what I expect:

2025-11_0136

Not a bad enhancement to the T-SQL language.

Summary

There’s a lot written on RegEx, so this post isn’t intended to delve deeply into what RegEx expressions you choose. Rather, I wanted to show the basics of this REGEXP_LIKE() function, and showcase one of the weird things I found when including this in the column list. I also haven’t looked at performance yet, though that certainly is something to be concerned about with larger datasets

There are other changes in SQL Server 2025, and I’ll try to examine some in the coming weeks.

Posted in Blog | Tagged , , , | Leave a comment

T-SQL Tuesday #192: SQL Server 2025 Backup Changes


I hosted this month, but I decided to put my own entry in as well. There are more things in this release than I expected, probably because of the overwhelming focus on Fabric from Microsoft that has drowned out other changes.

I’ve been a DBA (or Ops manager) for quite a bit of my career, and one of the things I’ve thought was top priority was backups. I always want to be sure I have a recovery strategy, because if I don’t, nothing matters. Things go wrong and systems fail and I need to protect systems.

Security is a close second, but backups really matter.

I was excited to see that full and differential backups can be set on secondary replicas in AGs. To be fair, I had assumed this would be working by SQL Server 2022, but I hadn’t checked. Glad it’s been added. I know, I know, I questioned if you need HA, but that’s more a staffing question than one of whether HA makes sense in general.

Backups, especially on larger systems, can be a load on the server. We’ve seen this with compressed backups natively, or with something like SQL Backup. As a result, offloading this to another system is something I’d want to do.

Of course, there’s still the challenge of making sure you get these all organized in one place (don’t have the 1 copy of your diff only on one secondary), but that’s a separate post.

Posted in Blog | Tagged , , | 1 Comment

Do You Really Need HA?

I ran across a thought-provoking post from Chrissy LeMaire asking if we should reconsider SQL Server HA. The post actually asks if you’ve considered not using it. The default from Chrissy, for most installations, is to use standalone SQL Servers. This isn’t to say she’s against HA solutions (FCIs or AGs), but that they often cause problems and might not be needed.

It’s an interesting position to consider. For a long time, I avoided SQL Server clusters as they were hard to setup with a lot of complexity, hardware requirements, etc., and didn’t really provide enough benefits over using log shipping with a second server for me.  These days I have clients with mostly AGs, and they seem to run fine. That being said, Chrissy notes that after she left a job, a network outages caused a bunch of downtime. I could see there being downtime, as the old database mirroring (and the it-will-never-die replication) needed a working network. If you have network issues, you better know how to manage your HA technology’s issues.

I also Brent reposted this on LinkedIn, with some fun comments. There was one great one, which said, “Can confirm. FCI is literally my friend’s largest downtime cause.” That one got me to stop and think a bit. If I were having stability issues with any of these technologies, I’d certainly look to replace them. I value my time off and my sleep.

I know people who default to using AGs with most servers, mostly to avoid someone calling when a system is down, but to be fair, I also think these are some of the more talented data people I know, so perhaps they can handle minor issues and prevent them from turning into major ones. However, Chrissy brings up a great point. SQL Server HA (or Oracle, PostgreSQL, Linux, etc.) isn’t simple. If you have staff turning over, are they qualified to keep things running?

Or do things just happen to run without these people until something breaks?

There is also the RTO issue. If you have a high RTO, like a day or two, is HA worth any amount of effort? Isn’t it better to rebuild things and restore? Especially in the cloud, where I might be able to redeploy a new VM/db/etc. and put data in it? Note, I’d want to be sure that I can get to my backups. The SLA on getting older files might be slow, and if it is, I’d want separate backups.

I do think that small to medium companies ought to rely more on backups and tools, like dbatools, to provide the ability to recreate a system. Adding in the complexity of HA certainly shouldn’t be the default, especially if you aren’t sure the staff will be around for the long term. The caveat with that might be if you use a company like ProcureSQL, StraightPath Solutions, Dallas DBAs or someone else, maybe you don’t worry about staff turnover.

Steve Jones

Listen to the podcast at Libsyn, Spotify, or iTunes.

Note, podcasts are only available for a limited time online.

Posted in Editorial | Tagged | 3 Comments

Monday Monitor Tips: ServiceNow Integration

Earlier this year I visited a customer that was using the Redgate Monitor webhook to integrate with ServiceNow. However, they were also trying to integrate in a richer way to create incidents and a richer experience.

We took that as a bit of feedback and recently released native ServiceNow integration to allow updates to incidents as status changes. Automatically.

This is part of a series of posts on Redgate Monitor. Click to see the other posts.

New Native Integration

Redgate Monitor originally only integrated natively with PagerDuty. Over time, we’ve add other ways to connect to other systems and send alerts or data to them. Slack and webhooks were available first , but recently we’ve changed.

If you click the gear icon in the upper right of Redgate Monitor, you’ll go to the configuration screen.

2025-10_line0097

In here, look for the Notification settings. This likely as an “Improved” tag if you look at it in late 2025. Click this.

2025-10_line0098

On the Notifications settings page, you see email settings at the top. Most customers configure this as email is still a great way to capture alerts and handle routing of info to a team.

2025-10_line0099

If you scroll down then you see the other types of notifications. Slack has been there for some time, and if you click this, you see the details you can configure.

2025-10_line0100

The new alert sinks are ServiceNow and Microsoft Teams. If I click the ServiceNow item, I see some details. I can enter my ServiceNow URL and the API key to connect. I can optionally also close an incident if the Alert ends. That’s always helpful.

2025-10_line0101

Microsoft Teams is similar. Here I’m just sending messages, as I do in Slack. I can enter the URL, which would be for the location I want messages sent. I can optionally send a message when the Alert ends.

2025-10_line0102

We still have the Webhook settings as well, so you can send to your orgs messaging system (Slack/Teams) and another location with a Webhook if you want. This might be useful for a different system or perhaps a dashboard where you are tracking information about databases.

2025-10_line0103

Redgate Monitor has grown to add these new options to give you the flexibility you need to handle alerting staff about database issues.

Summary

Managing a large estate is hard, and it is incredibly helpful to have tools to organize, track, and share information. Redgate Monitor is a great platform for this, and with these new integrations, it can be used alongside existing tools to prevent you from missing any of those important alerts.

Redgate Monitor is a world class monitoring solution for your database estate. Download a trial today and see how it can help you manage your estate more efficiently.

Posted in Blog | Tagged , , | Leave a comment