From the course: New Features in SQL Server 2016 for Developers

Unlock the full course today

Join today to access over 22,400 courses taught by industry experts or purchase this course individually.

STRING_SPLIT

STRING_SPLIT - SQL Server Tutorial

From the course: New Features in SQL Server 2016 for Developers

Start my 1-month free trial

STRING_SPLIT

- [Instructor] And this is probably my personal favorite feature in SQL Server 2016. For years we've done all sorts of interesting gymnastics to be able to do this, but now we have a built-in function for splitting strings. Exactly as you would have done with the CLR before and elaborate user-defined functions, you can now just call STRING_SPLIT as a built-in function to split text by a separator. It works as exactly as simply as you would expect. Here was have a string variable containing text separated by spaces. We ask the STRING_SPLIT function to split the contents of that variable based on the space as the separator. And it is a table-valued function. So you are returned a number of rows. One per value as separated by the by specified space. To makes this a little bit more useful, remember the CROSS APPLY operator. We'll create a quick little database, and in our database we'll create a table, and just like we very often find a lot of our data contains columns with comma…

Contents