
Explanation:
When using the OPENROWSET function in Azure Synapse Analytics to read JSON files from Azure Data Lake Storage, the correct FORMAT option is CSV (Option D), not JSON (Option A).
OPENROWSET Function Limitations: The OPENROWSET function in Azure Synapse Analytics does not have a native 'JSON' format option. The supported format values are:
JSON File Processing Workaround: To read JSON files using OPENROWSET, you must use the CSV format with specific delimiter configurations:
FORMAT = 'CSV'FIELDTERMINATOR = '0x0b' (vertical tab character)FIELDQUOTE = '0x0b'ROWTERMINATOR = '0x0b'Achieving Single JSON Record per Rowset: This configuration ensures that each JSON document is treated as a single field/row, meeting the requirement that "each rowset contains a single JSON record."
Microsoft Documentation Support: Official Microsoft documentation explicitly states that JSON files should be read using the CSV format with the specified delimiter settings.
SELECT doc
FROM OPENROWSET(
BULK 'https://storage1.dfs.core.windows.net/container1/folder1/*.json',
FORMAT = 'CSV',
FIELDTERMINATOR = '0x0b',
FIELDQUOTE = '0x0b',
ROWTERMINATOR = '0x0b'
) WITH (doc NVARCHAR(MAX)) AS rows
SELECT doc
FROM OPENROWSET(
BULK 'https://storage1.dfs.core.windows.net/container1/folder1/*.json',
FORMAT = 'CSV',
FIELDTERMINATOR = '0x0b',
FIELDQUOTE = '0x0b',
ROWTERMINATOR = '0x0b'
) WITH (doc NVARCHAR(MAX)) AS rows
This approach correctly processes JSON files while ensuring each rowset contains a single JSON record as required.
Ultimate access to all questions.
No comments yet.
You have an Azure subscription containing the following resources:
//IMG//
You need to read the files in storage1 using ad-hoc queries with the OPENROWSET function. The solution must ensure that each rowset contains a single JSON record.
What should you set the FORMAT option of the OPENROWSET function to?

A
JSON
B
DELTA
C
PARQUET
D
CSV