Blog Post

STRING_SPLIT Has Ordinals

,

I noticed the docs for STRING_SPLIT now show that there is a third parameter. This brings us an ordinal for the positioning of the data. The format is now:

STRING_SPLIT( string, separator [, enable_ordinal])

This is a bit or int that determines if a positional value is added to the result set. Here’s a quick demo.

No third parameter shows this:

2021-11-16 13_32_11-SQLQuery2.sql - dkranchapps.database.windows.net.SimpleTalk (sjones (89))_ - Mic

If I add a 1 for the third parameter, I see this:

2021-11-16 13_32_37-SQLQuery2.sql - dkranchapps.database.windows.net.SimpleTalk (sjones (89))_ - Mic

Right now this is only in Azure. I assume we’ll see this in SQL Server 2022, but we’ll have to wait and see.

Original post (opens in new tab)
View comments in original post (opens in new tab)

Rate

5 (1)

Share

Share

Rate

5 (1)