Openrowset

Vineet S 950 Reputation points
2024-09-22T12:57:48.2133333+00:00

Hi How to open the blow code using openrowset using synapse {"ONE":"JJJJ",

"TWO":"HH",

"TGHREE":"JJKK",

"4":"HJJJJ",

"5":"UUUU",

"_6":"UUUU",

"_7":"dbJJJJ",

"_8":""4GGG"",

"_9":"EE/",

"_ts":WW}

Azure Synapse Analytics
Azure Synapse Analytics
An Azure analytics service that brings together data integration, enterprise data warehousing, and big data analytics. Previously known as Azure SQL Data Warehouse.
4,935 questions
Azure Data Factory
Azure Data Factory
An Azure service for ingesting, preparing, and transforming data at scale.
10,740 questions
0 comments No comments
{count} votes

Accepted answer
  1. Ganesh Gurram 945 Reputation points Microsoft Vendor
    2024-09-23T07:28:34.6133333+00:00

    @Vineet S - Thanks for the question and using MS Q&A platform.

    Before jumping into the solution make sure to validate the JSON file which you are referring to?

    I had used online JSON Lint: JSON Online Validator and Formatter User's image

    Here is the modified valid JSON:

    JSONCopy

    {   
        "ONE": "JJJJ",
        "TWO": "HH",
        "THREE": "JJKK",
        "4": "HJJJJ",
        "5": "UUUU",
        "_6": "UUUU",
        "_7": "dbJJJJ",
        "_8": "4GGG",
        "_9": "EE/",
        "_ts": "WW"
    }
    

    I had used online JSON Lint: JSON Online Validator and Formatter

    User's image

     

    To open the provided JSON code using OPENROWSET in Synapse SQL, you need to first save the JSON code as a file in an Azure Storage account. Then, you can use the OPENROWSET function to read the contents of the file and return the content as a set of rows. Here is an example query that reads the contents of a JSON file using OPENROWSET: 

    Step1: Create Synapse Analytics workspace and open Synapse studio. 

    User's image

    Step2: Go to Data tab, click on linked and select the storage account which you created while creating synapse workspace. Select the storage account container and upload your Json file.

    User's image

    Step3:  Right click on Json file uploaded, select new SQL script and select top 100 rows. 

    User's image

    Step4: Once the SQL script is open, click on Run. You will see the output of the Json file displayed. 

    User's image

    For more details, refer to Query JSON files using serverless SQL pool in Azure Synapse Analytics 

    Hope this helps. Do let us know if you have any further queries.  

    ------------  

    If this answers your query, do click Accept Answer and Yes for was this answer helpful. And, if you have any further query do let us know.  


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.