2

Does Azure SQL support JSON data types?. I know that SQL server 2016 has been provided JSON support.

3 Answers 3

3

JSON is now available in Azure SQL Database see https://azure.microsoft.com/en-us/updates/public-preview-json-in-azure-sql-database/

Sign up to request clarification or add additional context in comments.

Comments

2

JSON is not currently supported, but will be available soon.

1 Comment

Is there a time frame you are looking at for this feature?
0

Now, Azure SQL Database supports native JSON data type. It's in preview currently. You can refer this blog to learn more about it.

The example below shows a table "Orders" with an order_id column of INT data type & an order_info column of JSON data type. JSON documents are inserted into the table using INSERT statement and the JSON documents are provided as a string.

DROP TABLE IF EXISTS dbo.Orders;
CREATE TABLE dbo.Orders (
    order_id int NOT NULL IDENTITY,
    order_info JSON NOT NULL
);
INSERT INTO dbo.Orders (order_info)
VALUES ('
{
    "OrderNumber": "S043659",
    "Date":"2022-05-24T08:01:00",
    "AccountNumber":"AW29825",
    "Price":59.99,
    "Quantity":1
}'), ('
{
    "OrderNumber": "S043661",
    "Date":"2022-05-20T12:20:00",
    "AccountNumber":"AW73565",
    "Price":24.99,
    "Quantity":3
}');

Now, the JSON functions can be used to extract properties of the JSON documents using SQL/JSON path expressions. The examples below shows how to extract the AccountNumber property from the JSON document:

SELECT o.order_id, JSON_VALUE(o.order_info, '$.AccountNumber') AS account_number FROM dbo.Orders as o;

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.