Skip to main content
Microsoft Idea

Synapse

New

Add Support for OPENJSON with Default Schema with tables

Vote (5) Share
Bob Duffy's profile image

Bob Duffy on 24 Aug 2023 12:18:29

Currently OPENJSON with Default Schema only works with json variables and not tables. This means that we cannot use OPENKSON when the json is in rows in a table.

Please add support for this so we can migrate Json based solutions from SqlPool or SqlDbEngine to Fabric.


Example that works on SqlPool and SqlDBEngine but not Fabric DW


IF OBJECT_ID('dbo.Foo') is not null

DROP TABLE dbo.Foo


CREATE TABLE [dbo].[Foo](

[SettingsID] [int] NULL,

[Settings] [varchar](4000) NULL

)


INSERT INTO dbo.Foo

VALUES (1, '{"SourceDirectory" : "dates", "DestinationDirectory" : "landing", "FileName" : "Dates.csv"}')


SELECT j.*

FROM dbo.Foo f

CROSS APPLY OPENJSON(f.Settings) j


Example that does work on Fabric


DECLARE @Settings VARCHAR(512) = '{"SourceDirectory" : "dates", "DestinationDirectory" : "landing", "FileName" : "Dates.csv"}'

SELECT * FROM OPENJSON(@Settings)