JSON string in MS SQL Server is too large to select without CAST ing to XML

24 views Asked by At

We have event data in a log table that is a JSON string of NVARCHAR(MAX) datatype. Some of the strings are too large to SELECT out of the table. But, if we CAST it, we can see the entire value.

SELECT CAST('<![CDATA[' + @JsonResult + ']]>' AS XML);

But now, the datatype is XML even though the value looks like JSON and is a valid JSON array if I copy/paste into a linter.

How can I work on this information using MS SQL JSON features such as

JSON_VALUE(myJson, '$.myValue')

or

OPENJSON(myJson, '$.myThings')
0

There are 0 answers