SQR72014: STRING_SPLIT has too many arguments specified.

AnhDTC 25 Reputation points
2023-06-19T14:47:29.6233333+00:00

When i import a BACDAC file to my SQL Server 2019, i got below error:

SQR72014: STRING_SPLIT has too many arguments specified.User's image

This file i exported from my Azure SQL, i can import to my local SQL Server before, but recently it cant not, please help me

Azure SQL Database
SQL Server Other
{count} votes

Accepted answer
  1. Yitzhak Khabinsky 26,586 Reputation points
    2023-06-19T15:29:12.21+00:00

    Hi @AnhDTC,

    The STRING_SPLIT() function got a 3rd parameter in SQL SERVER 2022, or Azure SQL Server.

    I see two possible options here:

    1. Your on-prem. SQL Server is not SQL Server 2022.
    2. Your on-prem. SQL Server is SQL Server 2022, but its compatibility level below 160. In such case you can easily change compatibility level back to 160.
    1 person found this answer helpful.
    0 comments No comments

3 additional answers

Sort by: Most helpful
  1. Guoxiong 8,206 Reputation points
    2023-06-19T15:25:27.5633333+00:00

    Based on Microsoft documentation about STRING_SPLIT, the enable_ordinal argument and ordinal output column are currently supported in Azure SQL Database, Azure SQL Managed Instance, and Azure Synapse Analytics (serverless SQL pool only). Beginning with SQL Server 2022 (16.x), the argument and output column are available in SQL Server.

    0 comments No comments

  2. Bruce (SqlWork.com) 77,686 Reputation points Volunteer Moderator
    2023-06-19T15:25:36.14+00:00

    What version of Sqlserver and compatibility level is your local server?

    0 comments No comments

  3. Erland Sommarskog 121.4K Reputation points MVP Volunteer Moderator
    2023-06-19T21:19:22.3366667+00:00

    As others have said, string_split with a column that returns the list position is not available in SQL 2019. You need to replace string_split with a user-defined function that performs the split and returns the position. You can find such a function in this short article on my web site: https://www.sommarskog.se/arrays-in-sql.html

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.