[OPENJSON ] How do you OPENJSON on Arrays of Arrays ?

 

If you have a primitive array, you can access the data using the value property after you expose the nested array as a JSON field. Using the JSON from the comment below, you can do this to get the values from a primitive array:

DECLARE @layout NVARCHAR(MAX) = N'{ "id":123, "locales":["en", "no", "se"] }'

SELECT 
    a.id
    , [Locale] = b.value 
FROM OPENJSON(@layout, '$') 
WITH (
    id INT '$.id',  
    locales NVARCHAR(MAX) '$.locales' AS JSON
) a
CROSS APPLY OPENJSON(a.locales,'$') b
Tham khảo: 
 CMSVietNameNet: + Procedure [dbo].[Vote_GetByDisplayConfigs]  + [dbo].[Series_Search]
 

Comments

Popular posts from this blog

31 Quy tắc trong thiết kế Cơ sở dữ liệu