Apply OPENJSON to a single column Apply OPENJSON to a single column json json

Apply OPENJSON to a single column


Here is something that will at least start you in the right direction.

SELECT P.ID, P.[Name], AttsData.[key], AttsData.[Value]FROM products P CROSS APPLY OPENJSON (P.Attributes) AS AttsData

The one thing that has me stuck a bit right now is the missing values (value is null in result)...

I was thinking of maybe doing some sort of outer/full join back to this, but even that is giving me headaches. Are you certain you need that? Or, could you do an existence check with the output from the SQL above?

I am going to keep at this. If I find a solution that matches your output exactly, I will add to this answer.

Until then... good luck!