Попробуйте использовать мою функцию dbo.JSON_MODIFY, которая решает проблему
CREATE FUNCTION dbo.JSON_MODIFY(@expression nvarchar(max), @path nvarchar(max), @newValue sql_variant)
RETURNS nvarchar(max)
AS
BEGIN
DECLARE @tempJson nvarchar(max) = (SELECT @newValue AS col1 FOR JSON PATH, WITHOUT_ARRAY_WRAPPER)
RETURN JSON_MODIFY(@expression, @path, JSON_VALUE(@tempJson, '$.col1'))
END
GO
DECLARE @info NVARCHAR(100)='{"name":"John","skills":["C#","SQL"]}'
PRINT dbo.JSON_MODIFY(@info, '$.code', NEWID())
PRINT dbo.JSON_MODIFY(@info, '$.date', GETDATE())
PRINT dbo.JSON_MODIFY(@info, '$.cost', CAST(1 AS money))
GO
Вывод результатов:
{"name": "John", "skills": ["C #"," SQL "]," code ":" 85543240-38C5-4647-B555-4388ADAD71F0 "}
{" name ":" John "," skills ": [" C # "," SQL "],"дата ":" 2019-10-03T16: 16: 10.600 "}
{" имя ":" Джон "," навыки ": [" C # "," SQL "]," стоимость ":" 1.0000 "}