SQL Server › JSON Support in SQL Server
How do you update a specific value within a JSON document stored in a column without replacing the entire JSON text?
IntermediateAnswer
You use the JSON_MODIFY function, specifying the path to the specific property you want to change and its new value, which returns the updated JSON text with just that one value modified, leaving the rest of the JSON document's structure and other values completely untouched.
UPDATE Users
SET ProfileData = JSON_MODIFY(ProfileData, '$.email', 'newemail@example.com')
WHERE UserId = 123;Real-world example A user account system updates just the email address stored within a user's JSON profile data using JSON_MODIFY, without needing to reconstruct or replace the entire JSON document for such a small, targeted change.