2

I'm using Microsoft SQL Server 2019 - 15.0.4236.7 (X64)

Compatibility Level is 2019 \ 150

I have a very simple query to transpose some JSON that is stored in a column:

SELECT OPENJSON ([fieldname])
  FROM mytable

But I keep recieing the error:

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

Do I need to enable something?

3
  • 2
    OPENJSON is a table valued function, not a scalar function.
    – Sean Lange
    Commented Jul 19, 2022 at 13:23
  • 1
    SELECT cols FROM mytable CROSS APPLY OPENJSON([fieldname]);
    – squillman
    Commented Jul 19, 2022 at 13:24
  • 4
    Alternatively, use JSON_VALUE or JSON_QUERY if you want to extract a single value or object, respectively. Commented Jul 19, 2022 at 13:25

0

Browse other questions tagged or ask your own question.