'STRING_SPLIT' is not a recognized built-in function name

南楼画角 提交于 2019-12-10 12:28:42

问题


The new STRING_SPLIT method is not available in my Azure SQL database. I had already ran ALTER DATABASE [DatabaseName] SET COMPATIBILITY_LEVEL = 130 a couple days ago, and I have verified the compatibility level is indeed set to 130. SELECT database_id, name, compatibility_level FROM sys.databases

Has anyone else been able to use the new method, and if so, did you need to do anything else to get it working?


回答1:


It was a syntax error. I was attempting to use the function as scalar and not as table valued.

Correct Syntax: SELECT Value FROM STRING_SPLIT('Lorem ipsum dolor sit amet.', ' ');




回答2:


The STRING_SPLIT function is available at compatibility level 130 or higher. If your database compatibility level is lower than 130, SQL Server will not be able to find and execute STRING_SPLIT function. You can change a compatibility level of database using the following command:

ALTER DATABASE DatabaseName SET COMPATIBILITY_LEVEL = 130

Note that compatibility level 120 might be default even in new Azure SQL Databases.

For reference:

Version - Highest Compatibility Level - Lowest Available Level

  • SQL 2017 - 140 - 100
  • SQL 2016 - 130 - 100
  • SQL 2014 - 120 - 100
  • SQL 2012 - 110 - 90
  • SQL 2008 - 100 - 80
  • SQL 2005 - 90 - 80
  • SQL 2000 - 80 - 80


来源:https://stackoverflow.com/questions/37616831/string-split-is-not-a-recognized-built-in-function-name

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!