{"id":4808,"date":"2016-03-18T22:14:28","date_gmt":"2016-03-18T16:44:28","guid":{"rendered":"http:\/\/sqlhints.com\/?p=4808"},"modified":"2016-03-18T22:14:28","modified_gmt":"2016-03-18T16:44:28","slug":"json_modify-function-in-sql-server-2016","status":"publish","type":"post","link":"https:\/\/sqlhints.com\/2016\/03\/18\/json_modify-function-in-sql-server-2016\/","title":{"rendered":"JSON_MODIFY Function in Sql Server 2016"},"content":{"rendered":"<p style=\"text-align: justify;\">JSON_MODIFY is one of the new JSON function introduced in Sql Server 2016. This function can be used to update the value of the property in a JSON string and returns the updated JSON string.<\/p>\n<p><strong>SYNTAX:<\/strong><\/p>\n<pre class=\"brush: sql; gutter: false\">\r\nJSON_MODIFY (json_string, json_path , new_value)\r\n<\/pre>\n<p style=\"text-align: justify;\">\n<strong>WHERE<\/strong><br \/>\n<strong>json_string :<\/strong> Is the JSON String which needs to be updated<br \/>\n<strong>json_path :<\/strong>  Is the location of the property in the json_string, whose value needs to be updated<br \/>\n<strong>new_value :<\/strong> The new value for the property in the json_string\n<\/p>\n<p style=\"text-align: justify;\">Let us understand this function with extensive list of examples.<\/p>\n<p><strong>EXAMPLE 1:<\/strong> Updating JSON Property Value<\/p>\n<p style=\"text-align: justify;\">In this example the JSON_MODIFY function is used to update the FirstName property value from Basavaraj to Basav<\/p>\n<pre class=\"brush: sql; gutter: false\">\r\nSELECT\r\n JSON_MODIFY(&#039;{&quot;FirstName&quot;:&quot;Basavaraj&quot;,&quot;Last Name&quot;:&quot;Biradar&quot;}&#039;,\r\n                   &#039;$.FirstName&#039;,&#039;Basav&#039;) AS &#039;Updated JSON&#039;\r\n<\/pre>\n<p><strong>RESULT:<\/strong><br \/>\n<a href=\"https:\/\/sqlhints.com\/wp-content\/uploads\/2016\/03\/JSON_MODIFY-Example-1.jpg\" rel=\"attachment wp-att-4813\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/sqlhints.com\/wp-content\/uploads\/2016\/03\/JSON_MODIFY-Example-1.jpg\" alt=\"JSON_MODIFY Example 1\" width=\"500\" height=\"222\" class=\"alignnone size-full wp-image-4813\" \/><\/a><\/p>\n<p><strong>[ALSO READ] <a href=\"https:\/\/sqlhints.com\/2015\/11\/15\/isjson-function-in-sql-server-2016\/\" target=\"_blank\">ISJSON Function in Sql Server 2016<\/a><\/strong><\/p>\n<p style=\"text-align: justify;\"><strong>EXAMPLE 2:<\/strong> Updating JSON property value where JSON_MODIFY function json_string and new_value are variables<\/p>\n<p style=\"text-align: justify;\">This example is same as Example 1, the only difference here is instead of passing JSON string as a constant assigning it to the variable @json_string and passing this variable to the function. And the new value is set to the variable @new_value and passed it to the function.<\/p>\n<pre class=\"brush: sql; gutter: false\">\r\nDECLARE @json_string VARCHAR(100) \r\n\t= &#039;{&quot;FirstName&quot;:&quot;Basavaraj&quot;,&quot;Last Name&quot;:&quot;Biradar&quot;}&#039;,\r\n\t@new_value VARCHAR(50) = &#039;Basav&#039;\r\nSELECT JSON_MODIFY(@json_string,&#039;$.FirstName&#039;,\r\n                     @new_value) AS &#039;Updated JSON&#039;\r\n<\/pre>\n<p><strong>RESULT:<\/strong><br \/>\n<a href=\"https:\/\/sqlhints.com\/wp-content\/uploads\/2016\/03\/JSON_MODIFY-Example-2.jpg\" rel=\"attachment wp-att-4815\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/sqlhints.com\/wp-content\/uploads\/2016\/03\/JSON_MODIFY-Example-2.jpg\" alt=\"JSON_MODIFY Example 2\" width=\"500\" height=\"270\" class=\"alignnone size-full wp-image-4815\" \/><\/a><\/p>\n<p style=\"text-align: justify;\">In the above example we can see that only the json_path is a string literal. Let us assign this also to a variable and pass it to the JSON_MODIFY function.<\/p>\n<pre class=\"brush: sql; gutter: false\">\r\nDECLARE @json_string VARCHAR(100) \r\n\t\t= &#039;{&quot;FirstName&quot;:&quot;Basavaraj&quot;,&quot;Last Name&quot;:&quot;Biradar&quot;}&#039;,\r\n\t@json_path VARCHAR(50) = &#039;$.FirstName&#039;,\r\n@new_value VARCHAR(50) = &#039;Basav&#039;\r\nSELECT JSON_MODIFY(@json_string, @json_path, \r\n                     @new_value) AS &#039;Updated JSON&#039;\r\n<\/pre>\n<p><strong>RESULT:<\/strong><\/p>\n<p style=\"text-align: justify;color: red;\">Msg 13610, Level 16, State 2, Line 5<br \/>\nThe argument 2 of the &#8220;JSON_MODIFY&#8221; must be a string literal.<\/p>\n<p style=\"text-align: justify;\">From the result we can see that the JSON PATH expression should always be a string literal<\/p>\n<p><strong>[ALSO READ] <a href=\"https:\/\/sqlhints.com\/2015\/11\/15\/json_value-function-in-sql-server-2016\/\" target=\"_blank\">JSON_VALUE Function in Sql Server 2016<\/a><\/strong><\/p>\n<p style=\"text-align: justify;\"><strong>EXAMPLE 3:<\/strong> Adding Id property and it\u2019s value to the JSON string<\/p>\n<p style=\"text-align: justify;\">The below script adds the Id property to the JSON string<\/p>\n<pre class=\"brush: sql; gutter: false\">\r\nSELECT JSON_MODIFY(\r\n   &#039;{&quot;FirstName&quot;:&quot;Basavaraj&quot;,&quot;Last Name&quot;:&quot;Biradar&quot;}&#039;\r\n   , &#039;$.Id&#039;, 1) AS &#039;Updated JSON&#039;\r\n<\/pre>\n<p><strong>RESULT:<\/strong><br \/>\n<a href=\"https:\/\/sqlhints.com\/wp-content\/uploads\/2016\/03\/JSON_MODIFY-Insert-Property-Example-3.jpg\" rel=\"attachment wp-att-4817\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/sqlhints.com\/wp-content\/uploads\/2016\/03\/JSON_MODIFY-Insert-Property-Example-3.jpg\" alt=\"JSON_MODIFY Insert Property Example 3\" width=\"500\" height=\"218\" class=\"alignnone size-full wp-image-4817\" \/><\/a><\/p>\n<p><strong>[ALSO READ] <a href=\"https:\/\/sqlhints.com\/2015\/11\/15\/lax-and-strict-json-path-modes-in-sql-server-2016\/\" target=\"_blank\">lax and strict JSON Path modes in Sql Server 2016<\/a><\/strong><\/p>\n<p style=\"text-align: justify;\"><strong>EXAMPLE 4:<\/strong> Impact of JSON Path mode on adding a new property to the existing JSON string<\/p>\n<p style=\"text-align: justify;\">Execute the following statement which is same as the example 3 script, the only difference is in the json_path the JSON path mode strict is specified.<\/p>\n<pre class=\"brush: sql; gutter: false\">\r\nSELECT JSON_MODIFY(\r\n      &#039;{&quot;FirstName&quot;:&quot;Basavaraj&quot;,&quot;Last Name&quot;:&quot;Biradar&quot;}&#039;\r\n      , &#039;$.Id&#039;, 1) AS &#039;Updated JSON&#039;\r\n<\/pre>\n<p><strong>RESULT:<\/strong><\/p>\n<p style=\"text-align: justify;color: red;\">Msg 13608, Level 16, State 2, Line 1<br \/>\nProperty cannot be found on the specified JSON path.<\/p>\n<p style=\"text-align: justify;\">From the result we can see that the strict path mode will not allow adding of a new property to the JSON string<\/p>\n<p style=\"text-align: justify;\">Execute the following statement which is same as the above example script, the only difference is in the JSON path mode. Here in this statement the JSON path mode is lax and it is the default path mode when it is not specified.<\/p>\n<pre class=\"brush: sql; gutter: false\">\r\nSELECT JSON_MODIFY(\r\n        &#039;{&quot;FirstName&quot;:&quot;Basavaraj&quot;,&quot;Last Name&quot;:&quot;Biradar&quot;}&#039;\r\n\t\t,&#039;lax$.Id&#039;, 1 )\t AS &#039;Updated JSON&#039;\r\n<\/pre>\n<p><strong>RESULT:<\/strong><br \/>\n<a href=\"https:\/\/sqlhints.com\/wp-content\/uploads\/2016\/03\/JSON_MODIFY-Insert-Property-lax-path-mode-Example-4.jpg\" rel=\"attachment wp-att-4818\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/sqlhints.com\/wp-content\/uploads\/2016\/03\/JSON_MODIFY-Insert-Property-lax-path-mode-Example-4.jpg\" alt=\"JSON_MODIFY Insert Property lax path mode Example 4\" width=\"500\" height=\"218\" class=\"alignnone size-full wp-image-4818\" \/><\/a><\/p>\n<p style=\"text-align: justify;\">From the result we can see that lax JSON Path mode allows adding a new JSON property. The JSON Path mode lax is the default path mode and if path mode is not specified it will consider it as lax. We can see that in example 3 when path mode is not specified we are able to add the new property.<\/p>\n<p><strong>[ALSO READ] <a href=\"https:\/\/sqlhints.com\/2015\/11\/15\/json_query-function-in-sql-server-2016\/\" target=\"_blank\">JSON_QUERY Function in Sql Server 2016<\/a><\/strong><\/p>\n<p style=\"text-align: justify;\"><strong>EXAMPLE 5:<\/strong> This example shows how setting a NULL value for the JSON property will remove that property from the JSON string<\/p>\n<pre class=\"brush: sql; gutter: false\">\r\nSELECT JSON_MODIFY(\r\n        &#039;{&quot;Id&quot;:1,&quot;FirstName&quot;:&quot;Basavaraj&quot;,&quot;Last Name&quot;:&quot;Biradar&quot;}&#039;\r\n\t\t,&#039;$.Id&#039;, NULL)\t AS &#039;Updated JSON&#039;\r\n<\/pre>\n<p><strong>RESULT:<\/strong><br \/>\n<a href=\"https:\/\/sqlhints.com\/wp-content\/uploads\/2016\/03\/Removing-an-Existing-Property-Example-5.jpg\" rel=\"attachment wp-att-4820\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/sqlhints.com\/wp-content\/uploads\/2016\/03\/Removing-an-Existing-Property-Example-5.jpg\" alt=\"Removing an Existing Property Example 5\" width=\"500\" height=\"219\" class=\"alignnone size-full wp-image-4820\" \/><\/a><\/p>\n<p><strong>[ALSO READ] <a href=\"https:\/\/sqlhints.com\/2015\/11\/15\/for-json-clause-in-sql-server-2016\/\" target=\"_blank\">FOR JSON Clause in Sql Server 2016<\/a><\/strong><\/p>\n<p style=\"text-align: justify;\"><strong>Example 6:<\/strong> This example explains how we can set a NULL value for a JSON property<\/p>\n<p style=\"text-align: justify;\">In the example 5 we saw that setting a NULL value for a JSON property resulted in that property getting deleted from the JSON string. But if we have requirement where we need to set the NULL value for a JSON property value then in the JSON path we have to specify strict JSON path mode as in the below script:<\/p>\n<pre class=\"brush: sql; gutter: false\">\r\nSELECT JSON_MODIFY(\r\n        &#039;{&quot;Id&quot;:1,&quot;FirstName&quot;:&quot;Basavaraj&quot;,&quot;Last Name&quot;:&quot;Biradar&quot;}&#039;\r\n\t\t,&#039;strict$.Id&#039;, NULL)\t AS &#039;Updated JSON&#039;\r\n<\/pre>\n<p><strong>RESULT:<\/strong><br \/>\n<a href=\"https:\/\/sqlhints.com\/wp-content\/uploads\/2016\/03\/Setting-NULL-value-for-a-JSON-property-Example-6.jpg\" rel=\"attachment wp-att-4821\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/sqlhints.com\/wp-content\/uploads\/2016\/03\/Setting-NULL-value-for-a-JSON-property-Example-6.jpg\" alt=\"Setting NULL value for a JSON property Example 6\" width=\"500\" height=\"213\" class=\"alignnone size-full wp-image-4821\" \/><\/a><\/p>\n<p><strong>[ALSO READ] <a href=\"https:\/\/sqlhints.com\/2015\/11\/22\/openjson-function-in-sql-server-2016\/\" target=\"_blank\">OPENJSON Function in Sql Server 2016<\/a><\/strong><\/p>\n<p style=\"text-align: justify;\"><strong>EXAMPLE 7:<\/strong> This example shows how we can append a value to the JSON Array.<\/p>\n<p style=\"text-align: justify;\">Execute the below statement to add the hobby Tennis to the Hobbies array:<\/p>\n<pre class=\"brush: sql; gutter: false\">\r\nSELECT JSON_MODIFY(\r\n            &#039;{&quot;Id&quot;:1,&quot;Name&quot;:&quot;Basavaraj&quot;,\r\n            &quot;Hobbies&quot;:[&quot;Blogging&quot;,&quot;Cricket&quot;]}&#039;,\r\n            &#039;append $.Hobbies&#039;,&#039;Tennis&#039;) AS &#039;Updated JSON&#039;\r\n<\/pre>\n<p><strong>RESULT:<\/strong><br \/>\n<a href=\"https:\/\/sqlhints.com\/wp-content\/uploads\/2016\/03\/Adding-value-to-the-JSON-Array-Example-7.jpg\" rel=\"attachment wp-att-4822\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/sqlhints.com\/wp-content\/uploads\/2016\/03\/Adding-value-to-the-JSON-Array-Example-7.jpg\" alt=\"Adding value to the JSON Array Example 7\" width=\"586\" height=\"258\" class=\"alignnone size-full wp-image-4822\" srcset=\"https:\/\/sqlhints.com\/wp-content\/uploads\/2016\/03\/Adding-value-to-the-JSON-Array-Example-7.jpg 586w, https:\/\/sqlhints.com\/wp-content\/uploads\/2016\/03\/Adding-value-to-the-JSON-Array-Example-7-300x132.jpg 300w\" sizes=\"auto, (max-width: 586px) 100vw, 586px\" \/><\/a><\/p>\n<p><strong>[ALSO READ] <a href=\"https:\/\/sqlhints.com\/2016\/03\/13\/string_split-function-in-sql-server-2016\/\" target=\"_blank\">STRING_SPLIT function in Sql Server 2016<\/a><\/strong><\/p>\n<p style=\"text-align: justify;\"><strong>EXAMPLE 8:<\/strong> This example shows how we can add a JSON object to the JSON string.<\/p>\n<p style=\"text-align: justify;\">Execute the following statement to add Address which is of type JSON object to the JSON string:<\/p>\n<pre class=\"brush: sql; gutter: false\">\r\nSELECT JSON_MODIFY(\r\n\t&#039;{&quot;Id&quot;:1,&quot;Name&quot;:&quot;Basavaraj&quot;}&#039;\r\n\t,&#039;$.Address&#039;\r\n\t,&#039;{&quot;State&quot;:&quot;KA&quot;,&quot;Country&quot;:&quot;India&quot;}&#039;) AS &#039;Updated JSON&#039;\r\n<\/pre>\n<p><strong>RESULT:<\/strong><br \/>\n<a href=\"https:\/\/sqlhints.com\/wp-content\/uploads\/2016\/03\/Adding-JSON-Object-to-JSON-string-Example-8.jpg\" rel=\"attachment wp-att-4823\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/sqlhints.com\/wp-content\/uploads\/2016\/03\/Adding-JSON-Object-to-JSON-string-Example-8.jpg\" alt=\"Adding JSON Object to JSON string Example 8\" width=\"500\" height=\"233\" class=\"alignnone size-full wp-image-4823\" \/><\/a><\/p>\n<p style=\"text-align: justify;\">From the result we can see that JSON_MODIFY function is escaping the double quote in the JSON object which is getting added. The reason for this is JSON_MODIFY function is treating the JSON object as a normal text instead of valid JSON.<\/p>\n<p style=\"text-align: justify;\">But if you want to avoid the escaping the JSON object which is getting added, use the JSON_QUERY function as shown below:<\/p>\n<pre class=\"brush: sql; gutter: false\">\r\nSELECT JSON_MODIFY(\r\n    &#039;{&quot;Id&quot;:1,&quot;Name&quot;:&quot;Basavaraj&quot;}&#039;\r\n    ,&#039;$.Address&#039;\r\n    ,JSON_QUERY(&#039;{&quot;State&quot;:&quot;KA&quot;,&quot;Country&quot;:&quot;India&quot;}&#039;)) \r\n           AS &#039;Updated JSON&#039;\r\n<\/pre>\n<p><strong>RESULT:<\/strong><br \/>\n<a href=\"https:\/\/sqlhints.com\/wp-content\/uploads\/2016\/03\/Adding-JSON-Object-to-JSON-string-Example-8-1.jpg\" rel=\"attachment wp-att-4824\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/sqlhints.com\/wp-content\/uploads\/2016\/03\/Adding-JSON-Object-to-JSON-string-Example-8-1.jpg\" alt=\"Adding JSON Object to JSON string Example 8 1\" width=\"500\" height=\"234\" class=\"alignnone size-full wp-image-4824\" \/><\/a><\/p>\n<p><strong>[ALSO READ] <a href=\"https:\/\/sqlhints.com\/2015\/12\/12\/datediff_big-function-in-sql-server-2016\/\" target=\"_blank\">DATEDIFF_BIG Function in Sql Server 2016<\/a><\/strong><\/p>\n<p style=\"text-align: justify;\"><strong>EXAMPLE 9:<\/strong> This example shows how we can modify the property value of JSON string stored in the Table Column.<\/p>\n<p style=\"text-align: justify;\">Create a Customer table as shown in the below image with sample data by the following script<\/p>\n<p><a href=\"https:\/\/sqlhints.com\/wp-content\/uploads\/2016\/03\/Customer-Table.jpg\" rel=\"attachment wp-att-4825\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/sqlhints.com\/wp-content\/uploads\/2016\/03\/Customer-Table.jpg\" alt=\"Customer Table\" width=\"500\" height=\"147\" class=\"alignnone size-full wp-image-4825\" \/><\/a><br \/>\n<strong>Script:<\/strong><\/p>\n<pre class=\"brush: sql; gutter: false\">\r\nCREATE DATABASE SqlHintsJSONModify\r\nGO\r\nUSE SqlHintsJSONModify\r\nGO\r\nCREATE TABLE dbo.Customer( \r\n    Id INT IDENTITY(1,1) NOT NULL PRIMARY KEY,\r\n    Name NVARCHAR(50), Detail NVARCHAR(MAX))\r\nGO\r\nINSERT INTO dbo.Customer ( Name, Detail )\r\nVALUES \r\n  (&#039;Basavaraj&#039;,&#039;{&quot;Address&quot;:{&quot;State&quot;:&quot;KA&quot;,&quot;Country&quot;:&quot;India&quot;}}&#039;),\r\n  (&#039;Kalpana&#039;,&#039;{&quot;Address&quot;:{&quot;State&quot;:&quot;MH&quot;,&quot;Country&quot;:&quot;India&quot;}}&#039;)\r\n<\/pre>\n<p style=\"text-align: justify;\">Execute the following statement and observe that the customer Kalpana\u2019s state property value in the Detail column is MH.<\/p>\n<pre class=\"brush: sql; gutter: false\">\r\nSELECT * FROM dbo.Customer WHERE Name = &#039;Kalpana&#039;\r\n<\/pre>\n<p><strong>RESULT:<\/strong><br \/>\n<a href=\"https:\/\/sqlhints.com\/wp-content\/uploads\/2016\/03\/DataBeforeUpdate.jpg\" rel=\"attachment wp-att-4826\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/sqlhints.com\/wp-content\/uploads\/2016\/03\/DataBeforeUpdate.jpg\" alt=\"DataBeforeUpdate\" width=\"500\" height=\"162\" class=\"alignnone size-full wp-image-4826\" \/><\/a><\/p>\n<p style=\"text-align: justify;\">Execute the following statement to update the Customer Kalpana\u2019s State to KA from MH.<\/p>\n<pre class=\"brush: sql; gutter: false\">\r\nUPDATE Customer\r\nSET Detail = JSON_MODIFY(Detail , &#039;$.Address.State&#039;,&#039;KA&#039;)\r\nWHERE Name = &#039;Kalpana&#039;\r\n<\/pre>\n<p style=\"text-align: justify;\">Now execute the following statement to check whether the customer Kalpana\u2019s state value is updated to KA from MH.<\/p>\n<pre class=\"brush: sql; gutter: false\">\r\nSELECT * FROM dbo.Customer WHERE Name = &#039;Kalpana&#039;\r\n<\/pre>\n<p><strong>RESULT:<\/strong><br \/>\n<a href=\"https:\/\/sqlhints.com\/wp-content\/uploads\/2016\/03\/DataAfterUpdate.jpg\" rel=\"attachment wp-att-4827\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/sqlhints.com\/wp-content\/uploads\/2016\/03\/DataAfterUpdate.jpg\" alt=\"DataAfterUpdate\" width=\"500\" height=\"171\" class=\"alignnone size-full wp-image-4827\" \/><\/a><\/p>\n<p><strong>[ALSO READ]<\/strong><\/p>\n<table border=\"1\">\n<tbody>\n<tr>\n<td style=\"border: 1pt solid windowtext; text-align: left; color: white; background-color: #808080;\" colspan=\"2\" valign=\"top\"><strong>New features in SQL SERVER 2016<\/strong><\/td>\n<\/tr>\n<tr>\n<td style=\"border: 1pt solid windowtext; text-align: left; background-color: #d8d8d8;\" colspan=\"2\">\n<ul>\n<li><a href=\"https:\/\/sqlhints.com\/2015\/10\/25\/json-in-sql-server-2016\/\" target=\"_blank\">Native JSON Support in Sql Server 2016<\/a>\n<ul>\n<li><a href=\"https:\/\/sqlhints.com\/2015\/11\/15\/for-json-clause-in-sql-server-2016\/\" target=\"_blank\">FOR JSON Clause in Sql Server 2016<\/a><\/li>\n<li><a href=\"https:\/\/sqlhints.com\/2015\/11\/22\/openjson-function-in-sql-server-2016\/\" target=\"_blank\">OPENJSON Function in Sql Server 2016<\/a><\/li>\n<li><a href=\"https:\/\/sqlhints.com\/2015\/11\/15\/isjson-function-in-sql-server-2016\/\" target=\"_blank\">ISJSON Function in Sql Server 2016<\/a><\/li>\n<li><a href=\"https:\/\/sqlhints.com\/2015\/11\/15\/json_value-function-in-sql-server-2016\/\" target=\"_blank\">JSON_VALUE Function in Sql Server 2016<\/a><\/li>\n<li><a href=\"https:\/\/sqlhints.com\/2015\/11\/15\/json_query-function-in-sql-server-2016\/\" target=\"_blank\">JSON_QUERY Function in Sql Server 2016<\/a><\/li>\n<li><a href=\"https:\/\/sqlhints.com\/2015\/11\/15\/lax-and-strict-json-path-modes-in-sql-server-2016\/\" target=\"_blank\">lax and strict JSON Path modes in Sql Server 2016<\/a><\/li>\n<li><a href=\"https:\/\/sqlhints.com\/2015\/11\/28\/indexing-strategy-for-json-value-in-sql-server-2016\/\" target=\"_blank\">Indexing Strategy for JSON Value in Sql Server 2016<\/a><\/li>\n<\/ul>\n<\/li>\n<li><a href=\"https:\/\/sqlhints.com\/2015\/11\/12\/drop-if-exists-statement-in-sql-server-2016\/\" target=\"_blank\">DROP IF EXISTS Statement in Sql Server 2016<\/a><\/li>\n<li><a href=\"https:\/\/sqlhints.com\/2015\/11\/29\/compare-execution-plan-in-sql-server-2016\/\" target=\"_blank\">Compare Execution Plans in Sql Server 2016<\/a><\/li>\n<li><a href=\"https:\/\/sqlhints.com\/2015\/12\/11\/live-query-statistics-in-sql-server-2016\/\" target=\"_blank\">Live Query Statistics in Sql Server 2016<\/a><\/li>\n<li><a href=\"https:\/\/sqlhints.com\/2015\/12\/12\/datediff_big-function-in-sql-server-2016\/\" target=\"_blank\">DATEDIFF_BIG Function in Sql Server 2016<\/a><\/li>\n<li><a href=\"https:\/\/sqlhints.com\/2015\/12\/12\/difference-between-datediff-and-datediff_big-functions-in-sql-server\/\" target=\"_blank\">Difference between DATEDIFF and DATEDIFF_BIG functions in Sql Server<\/a><\/li>\n<li><a href=\"https:\/\/sqlhints.com\/2015\/12\/15\/session_context-in-sql-server-2016\/\" target=\"_blank\">SESSION_CONTEXT in Sql Server 2016<\/a><\/li>\n<li><a href=\"https:\/\/sqlhints.com\/2015\/12\/28\/gzip-compress-and-decompress-functions-in-sql-server-2016\/\" target=\"_blank\">GZIP COMPRESS and DECOMPRESS functions in Sql Server 2016<\/a><\/li>\n<li><a href=\"https:\/\/sqlhints.com\/2015\/12\/31\/temporal-tables-in-sql-server-2016-part-1-introduction-to-temporal-tables-and-dml-operations-on-the-temporal-table\/\" target=\"_blank\">Temporal Tables in Sql Server 2016<\/a><\/li>\n<ul>\n<li><a href=\"https:\/\/sqlhints.com\/2015\/12\/31\/temporal-tables-in-sql-server-2016-part-1-introduction-to-temporal-tables-and-dml-operations-on-the-temporal-table\/\" target=\"_blank\">Introduction to Temporal Tables and DML operations on the Temporal Table<\/a><\/li>\n<li><a href=\"https:\/\/sqlhints.com\/2015\/12\/31\/temporal-tables-in-sql-server-2016-part-2-querying-system-versioned-temporal-table\/\" target=\"_blank\">Querying System-Versioned Temporal Table<\/a><\/li>\n<li><a href=\"https:\/\/sqlhints.com\/2015\/12\/31\/temporal-tables-in-sql-server-2016-part-3-enabling-system-versioning-for-an-existing-regular-table\/\" target=\"_blank\">Enabling System Versioning for an Existing Regular Table<\/a><\/li>\n<li><a href=\"https:\/\/sqlhints.com\/2015\/12\/31\/temporal-tables-in-sql-server-2016-part-4-ddl-operations-on-the-system-versioned-temporal-table\/\" target=\"_blank\">DDL operations on the System-Versioned Temporal Table<\/a><\/li>\n<\/ul>\n<li><a href=\"https:\/\/sqlhints.com\/2016\/01\/23\/row-level-security-in-sql-server-2016\/\" target=\"_blank\">Row level security in Sql Server 2016<\/a><\/li>\n<li><a href=\"https:\/\/sqlhints.com\/2016\/02\/21\/dynamic-data-masking-in-sql-server-2016\/\" target=\"_blank\">Dynamic Data Masking in Sql Server 2016<\/a><\/li>\n<li><a href=\"https:\/\/sqlhints.com\/2016\/03\/13\/string_split-function-in-sql-server-2016\/\" target=\"_blank\">STRING_SPLIT function in Sql Server 2016<\/a><\/li>\n<\/ul>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n","protected":false},"excerpt":{"rendered":"<p>JSON_MODIFY is one of the new JSON function introduced in Sql Server 2016. This function can be used to update the value of the property in a JSON string and returns the updated JSON string. SYNTAX: JSON_MODIFY (json_string, json_path , new_value) WHERE json_string : Is the JSON String which needs to be updated json_path : &hellip; <a href=\"https:\/\/sqlhints.com\/2016\/03\/18\/json_modify-function-in-sql-server-2016\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">JSON_MODIFY Function in Sql Server 2016<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[3,830],"tags":[1189,1184,1188,1173,1175,1174,1180,1178,1179,885,1182,1185,1186,1187,321,835,834,1183,1177,1176,1181,1190],"class_list":["post-4808","post","type-post","status-publish","format-standard","hentry","category-sql-server","category-sql-server-2016","tag-add-json-object","tag-adding-property-to-json","tag-append-value-to-json-array","tag-json_modify","tag-json_modify-function","tag-json_modify-function-in-sql","tag-json_modify-function-with-examples","tag-json_modify-in-sql-2016","tag-json_modify-in-sql-server-2016","tag-msg-13608","tag-msg-13610","tag-property-cannot-be-found-on-the-specified-json-path","tag-removing-json-property","tag-setting-json-property-value-to-null","tag-sql","tag-sql-2016","tag-sql-server-2016","tag-the-argument-2-of-the-json_modify-must-be-a-string-literal","tag-update-json-column-value-in-sql","tag-update-json-in-sql","tag-update-json-property-value","tag-updating-json-column-value"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p3xNAz-1fy","_links":{"self":[{"href":"https:\/\/sqlhints.com\/wp-json\/wp\/v2\/posts\/4808","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/sqlhints.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sqlhints.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sqlhints.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/sqlhints.com\/wp-json\/wp\/v2\/comments?post=4808"}],"version-history":[{"count":15,"href":"https:\/\/sqlhints.com\/wp-json\/wp\/v2\/posts\/4808\/revisions"}],"predecessor-version":[{"id":4835,"href":"https:\/\/sqlhints.com\/wp-json\/wp\/v2\/posts\/4808\/revisions\/4835"}],"wp:attachment":[{"href":"https:\/\/sqlhints.com\/wp-json\/wp\/v2\/media?parent=4808"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sqlhints.com\/wp-json\/wp\/v2\/categories?post=4808"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sqlhints.com\/wp-json\/wp\/v2\/tags?post=4808"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}