Skip to content
Advertisement

Convert simple JSON to SQL SELECT Statement

I have the following JSON:

I’m trying to convert to SQL as follows:

All i get is an empty resultset (0 rows when it should be 2 rows), what am i doing wrong?

Advertisement

Answer

Your JSON has square brackets round the whole thing, meaning it is an array (it only has one element) so your OPENJSON starting point will have to be $[0].value

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement