Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

OPENJSON does not get recognized in Azure SQL DB

I want to use OPENJSON function in Azure SQL DB, but when I try to execute the function, I get the following error:

Msg 195, Level 15, State 10, Line 25 'OPENJSON' is not a recognized built-in function name.

I had researched and found this link saying

The OPENJSON function is available only under compatibility level 130 or higher. If your database compatibility level is lower than 130, SQL Server can't find and run the OPENJSON function. Other JSON functions are available at all compatibility levels.

As suggested, checked compatibility level with following

select * from sys.databases

and confirmed it was 140 which is higher than the minimum requirement.

So, wouldn't it it work?

like image 356
Aaron Kim Avatar asked Mar 30 '26 17:03

Aaron Kim


1 Answers

OPENJSON is a table-valued function, and it must appear in the a valid location for a table expression.

EG

select openjson('{}')

fails with

Msg 195, Level 15, State 10, Line 29 'openjson' is not a recognized built-in function name.

But

select * from openjson('{}')

works.

like image 79
David Browne - Microsoft Avatar answered Apr 02 '26 13:04

David Browne - Microsoft