DP-203 Exam QuestionsBrowse all questions from this exam

DP-203 Exam - Question 123


DRAG DROP -

You have an Azure Synapse Analytics workspace named WS1.

You have an Azure Data Lake Storage Gen2 container that contains JSON-formatted files in the following format.

You need to use the serverless SQL pool in WS1 to read the files.

How should you complete the Transact-SQL statement? To answer, drag the appropriate values to the correct targets. Each value may be used once, more than once, or not at all. You may need to drag the split bar between panes or scroll to view content.

NOTE: Each correct selection is worth one point.

Select and Place:

Show Answer
Correct Answer:

Box 1: openrowset -

The easiest way to see to the content of your CSV file is to provide file URL to OPENROWSET function, specify csv FORMAT.

Example:

SELECT *

FROM OPENROWSET(

BULK 'csv/population/population.csv',

DATA_SOURCE = 'SqlOnDemandDemo',

FORMAT = 'CSV', PARSER_VERSION = '2.0',

FIELDTERMINATOR =',',

ROWTERMINATOR = '\n'

Box 2: openjson -

You can access your JSON files from the Azure File Storage share by using the mapped drive, as shown in the following example:

SELECT book.* FROM -

OPENROWSET(BULK N't:\books\books.json', SINGLE_CLOB) AS json

CROSS APPLY OPENJSON(BulkColumn)

WITH( id nvarchar(100), name nvarchar(100), price float,

pages_i int, author nvarchar(100)) AS book

Reference:

https://docs.microsoft.com/en-us/azure/synapse-analytics/sql/query-single-csv-file https://docs.microsoft.com/en-us/sql/relational-databases/json/import-json-documents-into-sql-server

Discussion

11 comments
Sign in to comment
Maunik
Sep 11, 2021

Answer is correct https://docs.microsoft.com/en-us/azure/synapse-analytics/sql/query-json-files

Lrng15
Sep 23, 2021

answer is correct as per this link

gf2tw
Sep 10, 2021

The question and answer seem out of place, there was no mention of the CSV and the query in the answer doesn't match up with openjson at all

gssd4scoder
Nov 3, 2021

agree with you, very misleading

anto69
Jan 12, 2022

agree with u

dev2dev
Jan 17, 2022

Look at the WITH statement, the csv column can contain json data.

vctrhugo
Jun 25, 2023

The easiest way to see to the content of your JSON file is to provide the file URL to the OPENROWSET function, specify csv FORMAT, and set values 0x0b for fieldterminator and fieldquote.

ELJORDAN23
Jan 16, 2024

Answer is correct: https://learn.microsoft.com/en-us/azure/synapse-analytics/sql/query-json-files#query-json-files-using-openjson

PallaviPatel
Jan 29, 2022

correct

SebK
Mar 22, 2022

Correct

Deeksha1234
Jul 30, 2022

correct

zorko10
Oct 21, 2022

does openjson do the same thing as jsoncontent ? I tried running a query on a json file and the auto filled code used jsoncontent instead of openjson

mamahani
May 11, 2023

openrowset / openjson

kkk5566
Sep 5, 2023

Answer is correct

KarlGardnerDataEngineering
May 28, 2024

This took me about 10 hours to understand this query

evangelist
Jul 14, 2024

To complete the Transact-SQL statement for reading JSON-formatted files using the serverless SQL pool in WS1, you should use OPENROWSET to access the data and OPENJSON to parse the JSON content. Here is the correct completion of the statement: