with customprop as ( SELECT ea.CustomPropertiesJson, JSON_VALUE ( ea.CustomPropertiesJson,'$.nomeProdotto') as nomeProdotto , JSON_VALUE ( ea.CustomPropertiesJson,'$.nomeProdottoVisibileCreazioneIntervista') as nomeProdottoVisibileCreazioneIntervista , JSON_VALUE ( ea.CustomPropertiesJson,'$.id') as idJson , JSON_VALUE ( ea.CustomPropertiesJson,'$.apriFormat') as apriFormat , JSON_VALUE ( ea.CustomPropertiesJson,'$.idMaster') as idMaster , JSON_VALUE ( ea.CustomPropertiesJson,'$.idModelloDaInviare') as idModelloDaInviare , ISNUMERIC(code) is_numeric, --JSON_MODIFY ( ea.CustomPropertiesJson , '$.idModelloDaInviare' , CAST(code AS NUMERIC(12,0)) ) as newIdModello, ea.Id, ea.Description, ea.Code FROM [Finservice.SurveyDb.Test].[dbo].[EventArguments] as ea) , ncustomprop as ( select id,idJson,nomeProdotto,Description,apriFormat,idMaster,idModelloDaInviare,JSON_MODIFY ( CustomPropertiesJson , '$.idModelloDaInviare' , CAST(code AS NUMERIC(12,0)) ) as newIdModello from customprop where is_numeric = 1 and idModelloDaInviare= -1 ) --select from ncustomprop update [Finservice.SurveyDb.Test].[dbo].[EventArguments] set CustomPropertiesJson = ncustomprop.newIdModello from ncustomprop join [Finservice.SurveyDb.Test].[dbo].[EventArguments] on [Finservice.SurveyDb.Dev_Server].[dbo].[EventArguments].id = ncustomprop.id
Comments
0 B
|👍
/👎
0 B
|👍
/👎