Deprecated: Array and string offset access syntax with curly braces is deprecated in /www/wp-content/plugins/Ultimate_VC_Addons/admin/bsf-core/auto-update/admin-functions.php on line 11 SQL Split String Option - Crestwood Associates

SQL Split String Option

I’ve been waiting a long time for this.  If you’ve had to split strings in SQL in the past, keep reading!

Microsoft SQL Server 2016 now has a native solution available, meaning, you can supply a delimited string and join against it like a collection of rows.

There have been many work-arounds for this over the years, but if you have SQL 2016, you don’t need them any longer.

Here’s the syntax:

SELECT * FROM STRING_SPLIT(‘a,b,cd’, ‘,’);

/* result
value
--------
a
b
cd
*/

Note: this ONLY works in SQL 2016 on databases that are in 130 compatibility.  

Leave a Reply