STRING_SPLIT with order not working on SQL Server 2022
25
votes
1
answer
1440
views
I need to use STRING_SPLIT with enabled ordering:
We have upgraded all of our servers to SQL Server 2022 and change the compatibility level to 160, but the following code is not working:
SELECT * FROM STRING_SPLIT('Lorem ipsum dolor sit amet.', ' ', 1);
The error is:
> Msg 8748, Level 16, State 1, Line 1 The enable_ordinal argument for
> STRING_SPLIT only supports constant values (not variables or columns).
The production environment is:
Microsoft SQL Server 2022 (RTM-CU11) (KB5032679) - 16.0.4105.2 (X64)
Nov 14 2023 18:33:19
Copyright (C) 2022 Microsoft Corporation
Standard Edition (64-bit) on Windows Server 2019 Standard 10.0 (Build 17763: )
The version of the SSMS is:
We have tested the code on the latest CU:
The only thing I have found is this answer pointing that:
> The problem is that SSMS has IntelliSense / tooltips coded without
> conditional logic based on version, and the code is ahead of the
> engine. Currently the functionality is only available in Azure SQL
> Database, Managed Instance, and Synapse.
Still, I am not sure where is the issue - the docs, the engine, the SSMS or something I am not doing right.
Note: the issue is the same on Azure Data Studio.



Asked by gotqn
(4348 rep)
Dec 3, 2024, 11:46 AM
Last activity: Dec 3, 2024, 12:33 PM
Last activity: Dec 3, 2024, 12:33 PM