Launch week: the Season Pass & Fundamentals Week are 50% off — ends in 19d 11h 41mSee the sale

Author: Erik Darling

Restoring tempdb since GETDATE(). Now blogging at ErikDarlingData.com.

How to Split Strings with SQL Server 2016 & Newer

Before SQL Server 2016, you might have used a function like Jeff Moden's DelimitedSplit8k function or Adam Machanic's CLR version. (Aaron Bertrand has a huge post comparing performance of different string splitting methods, too.)

But there's a new, faster game in town! SQL Server 2016 introduces a brand new STRING_SPLIT function:
[crayon-6a37d658312d4266331995/]
Here's how the results look:

Read more about How to Split Strings with SQL Server 2016 & Newer 52 comments — Join the discussion

Why most of you should leave Auto-Update Statistics on

Oh God, he's talking about statistics again Yeah, but this should be less annoying than the other times. And much shorter. You see, I hear grousing. Updating statistics was bringin' us down, man. Harshing our mellow. The statistics would just update, man, and it would take like... Forever, man. Man. But no one would actually…

Read more about Why most of you should leave Auto-Update Statistics on 16 comments — Join the discussion
Performance Tuning

Unique Indexes and Row Modifications: Weird

Confession time This started off with me reading a blurb in the release notes about SQL Server 2016 CTP 3.3. The blurb in question is about statistics. They're so cool! Do they get fragmented? NO! Stop trying to defragment them, you little monkey. Autostats improvements in CTP 3.3 Previously, statistics were automatically recalculated when the…

Read more about Unique Indexes and Row Modifications: Weird 3 comments — Join the discussion

Changes to auto update stats thresholds in SQL Server 2016

TL;DR
As of CTP 3.3, it's the same behavior as Trace Flag 2371, in 2008 R2 SP1 and onward. That basically means that the bigger your table is, the fewer rows need to be modified before an automatic statistics update occurs.
Slightly longer...
The change was announced over here. At first I thought, woah, cool, they thought about this and made big changes. But no, much like Trace Flags 1117 and 1118 being enabled for tempdb, it's just...

Read more about Changes to auto update stats thresholds in SQL Server 2016 11 comments — Join the discussion

SQL Server 2005 End Of Support: Keep Calm And Do This Stuff

Ask not for whom the bell tolls
It tolls for SQL Server 2005. Which means in a few short months, you'll need to get out of Dodge. I'm sure you all have your upgrade ducks in a row, you've studied the breaking changes, the upgrade path, and maybe even downloaded the latest upgrade advisor. Smarty pants you are! I'm proud of you.

Read more about SQL Server 2005 End Of Support: Keep Calm And Do This Stuff 6 comments — Join the discussion

Getting Started With Oracle: Working With Numbers

Math is math is math I haven't found any tremendous differences working with numbers between Oracle and SQL Server. Both offer pretty standard functions to calculate your calculations. Oracle has MOD(), SQL Server uses %. This is likely something you'll want to be aware of if you're working cross-platform, but nothing earth shattering. One really…

Read more about Getting Started With Oracle: Working With Numbers 11 comments — Join the discussion

Getting Started With Oracle: Working With Strings

The almighty string
It's so good for holding all sorts of things. Chicken roulade, beef roulade, salmon roulade. It's also the way you should store phone numbers. If I could go back in time to when I first started working with SQL, that's what I'd tell myself. Stop. Just, please, for the love of Codd, STOP TRYING TO STORE PHONE NUMBERS AS INTEGERS. It will only end in heartbreak and weird exponential notation.

Read more about Getting Started With Oracle: Working With Strings 9 comments — Join the discussion
T-SQL & Development

Don’t Use Scalar User-Defined Functions in Computed Columns.

Scalar functions in computed columns cause all queries that hit that table to execute serially. But it gets worse!
Scalar functions in computed columns
cause index maintenance to go single-threaded.
If you're running Expensive Edition, index rebuilds can be both online and parallel. That's pretty cool, because it keeps all your gadgets and gizmos mostly available during the whole operation, and the parallel bit usually makes things faster.

Read more about Don’t Use Scalar User-Defined Functions in Computed Columns. 27 comments — Join the discussion

Still Serial After All These Years

With each new version of SQL comes a slew of new stuff
While some changes are cosmetic, others bewildering, and the rest falling somewhere between "who cares about JSON?" and "OH MY GOD TAKE MY MONEY!", but not really my money, because I only buy developer edition. Aaron Bertrand has done a better job finding, and teaching you how to find new features than I could. Head over to his blog if you want to dive in.

Read more about Still Serial After All These Years 30 comments — Join the discussion

What happens to transaction log backups during full backups?

TL;DR
Unless you're on SQL 2000, don't worry about scheduling log backups during full backups
Log backups during full backups won't truncate the transaction log
You want to keep taking log backups in case your full backup fails
The first time I ever set up backups
Was, unfortunately, using a maintenance plan. All of the databases were in simple recovery. It was largely used for staging and tenderizing data during ETL. No log backups need apply.

Read more about What happens to transaction log backups during full backups? 28 comments — Join the discussion