One of the built in functions - 'JSON_ARRAY' is not recognized

Natraj 0 Reputation points
2023-06-30T15:20:21.43+00:00

JSON_ARRAY is an inbuilt function available in Azure SQL Managed Instance
Ref:
https://learn.microsoft.com/en-us/sql/t-sql/functions/json-array-transact-sql?view=sql-server-ver16

But it is not supported in a Database created under SQL Managed Instance Resource

I checked the version of this database and got - Microsoft SQL Azure (RTM) - 12.0.2000.8 Apr 27 2023 03:47:17 Copyright (C) 2022 Microsoft Corporation

Why won't a simple query like - SELECT JSON_ARRAY(1) - won't work on this?

It gives error,
Msg 195, Level 15, State 10, Line 1

'JSON_ARRAY' is not a recognized built-in function name.

Azure SQL Database
SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
14,493 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Erland Sommarskog 120.6K Reputation points MVP Moderator
    2023-06-30T21:31:05.59+00:00

    The function works in the Azure Managed Instance I have access to. But I recall that when I first got access to it, generate_series did not work, that's another new function added in SQL 2022. I was told that the instance was lagging behind in patch level, and it has since then been fixed.

    So it might be something similar in your case. And this "patch level" (in lieu of a better word) is not really something that is exposed, as far as I know. I think you should open a case with Azure support to inquire.

    By the way, someone may suggest that it is related to the compatibility level of the database, but it is not. I tried on my MI database to set the compat level down 100, and JSON_ARRAY was still recognised. And this is the normal state of affairs; adding a new built-in scalar function can never break anything, since user-defined scalar functions always must be accessed in two-part notation.

    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.