Я сгенерировал документ Json, используя FOR JSON PATH
в SQL Server, однако, когда я пытаюсь разобрать его обратно в таблицу, я просто получаю NULL
.
SELECT *
FROM OPENJSON('{"Customer":[{"CustomerID":10021,"CustomerNumber":"ALFKI","Customer":"Alfreds Futterkiste","City":"Berlin","OrderID":11060,"UnitPrice":45.6000,"ProductsOnOrder":15,"ShipCity":"Berlin"},{"CustomerID":10021,"CustomerNumber":"ALFKI","Customer":"Alfreds Futterkiste","City":"Berlin","OrderID":11061,"UnitPrice":18.0000,"ProductsOnOrder":21,"ShipCity":"Berlin"},{"CustomerID":10021,"CustomerNumber":"ALFKI","Customer":"Alfreds Futterkiste","City":"Berlin","OrderID":11062,"UnitPrice":12.0000,"ProductsOnOrder":2,"ShipCity":"Berlin"},{"CustomerID":10021,"CustomerNumber":"ALFKI","Customer":"Alfreds Futterkiste","City":"Berlin","OrderID":11187,"UnitPrice":43.9000,"ProductsOnOrder":20,"ShipCity":"Berlin"},{"CustomerID":10021,"CustomerNumber":"ALFKI","Customer":"Alfreds Futterkiste","City":"Berlin","OrderID":11217,"UnitPrice":10.0000,"ProductsOnOrder":6,"ShipCity":"Berlin"},{"CustomerID":10021,"CustomerNumber":"ALFKI","Customer":"Alfreds Futterkiste","City":"Berlin","OrderID":11218,"UnitPrice":18.0000,"ProductsOnOrder":15,"ShipCity":"Berlin"},{"CustomerID":10021,"CustomerNumber":"ALFKI","Customer":"Alfreds Futterkiste","City":"Berlin","OrderID":11554,"UnitPrice":55.0000,"ProductsOnOrder":15,"ShipCity":"Berlin"},{"CustomerID":10021,"CustomerNumber":"ALFKI","Customer":"Alfreds Futterkiste","City":"Berlin","OrderID":11555,"UnitPrice":13.0000,"ProductsOnOrder":2,"ShipCity":"Berlin"},{"CustomerID":10021,"CustomerNumber":"ALFKI","Customer":"Alfreds Futterkiste","City":"Berlin","OrderID":11846,"UnitPrice":25.0000,"ProductsOnOrder":16,"ShipCity":"Berlin"},{"CustomerID":10021,"CustomerNumber":"ALFKI","Customer":"Alfreds Futterkiste","City":"Berlin","OrderID":11847,"UnitPrice":45.6000,"ProductsOnOrder":2,"ShipCity":"Berlin"},{"CustomerID":10021,"CustomerNumber":"ALFKI","Customer":"Alfreds Futterkiste","City":"Berlin","OrderID":11992,"UnitPrice":13.2500,"ProductsOnOrder":40,"ShipCity":"Berlin"},{"CustomerID":10021,"CustomerNumber":"ALFKI","Customer":"Alfreds Futterkiste","City":"Berlin","OrderID":11993,"UnitPrice":21.5000,"ProductsOnOrder":20,"ShipCity":"Berlin"}]}')
WITH
(
CustomerID NVARCHAR(255) '$.Customer'
)