SQL Server 2016, Invalid object name 'STRING_SPLIT'

后端 未结 3 1441
一个人的身影
一个人的身影 2020-12-15 04:34

In SQL Server 2016 I receive this error with STRING_SPLIT function

SELECT * FROM STRING_SPLIT(\'a,b,c\',\',\')

Error:

<
相关标签:
3条回答
  • 2020-12-15 04:46

    Make sure that the database compatibility level is 130

    you can use the following query to change it:

    ALTER DATABASE [DatabaseName] SET COMPATIBILITY_LEVEL = 130
    
    0 讨论(0)
  • 2020-12-15 04:51

    If you can't change the COMPATIBILITY_LEVEL of the database you are working in, you can try looking at other databases on the same server to find one with a higher COMPATIBILITY_LEVEL. I found that the "master" database on my target server was at COMPATIBILITY_LEVEL = 140, so I connected to that database, and then executed my query, which actually ran against (fully qualified) tables in other databases on the server whose COMPATIBILITY_LEVEL was less than 130. It worked! Just query the various databases on your server with

    SELECT compatibility_level  FROM sys.databases WHERE name = '<database_name>'; 
    

    to find one that is >= 130.

    0 讨论(0)
  • 2020-12-15 04:52

    I was using Split_string, which felt grammatically correct in English, but my old eyes didn't see that it should be STRING_SPLIT ... so, if you're a bit mentally challenged like me, then check you've typed the command the right way! :)

    0 讨论(0)
提交回复
热议问题