5

STRING_SPLIT Has Ordinals

 3 years ago
source link: https://voiceofthedba.com/2021/11/17/string_split-has-ordinals/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

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.

This entry was posted in Blog and tagged syndicated, T-SQL. Bookmark the permalink.

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK