SQL Server 2016: Introduced JSON support, to store and retrieve JSON document

This is one of the interesting topics, in the new version of SQL Server 2016 we can store JSON formatted data.

Now a day JSON data type is a common feature for all new coming RDBMS product versions like: PostgreSQL 9.4 and MySQL 5.7 have already introduced this.

Now We can say, we have SQL Server 2016 with the RDBMS + NOSQL concepts.
We can store JSON data as nvarchar, but the JSON related functions have the advantage of enforcing that each stored value is valid according to the JSON rules.

Small demonstration on SQL Server 2016 JSON:

Create a sample table and define two column as NVARCHAR to store JSON data:

Use ISJSON() and add check constraint in json columns:
If your json format and document is correct, It returns true other It returns false.

Insert few sample JSON data:

SELECT json data:

Use JSON_VALUE() in WHERE Clause:

Anvesh Patel

Leave a Reply

1 Comment on "SQL Server 2016: Introduced JSON support, to store and retrieve JSON document"

Notify of
avatar
Sort by:   newest | oldest | most voted
marni
Guest

very simple and nice put up. thanks

wpDiscuz