March 14, 2022 at 1:53 am
I have the following
declare @X nvarchar(max)
set @X='[
{
"a": "",
"b": "",
"c": "",
"e": "",
"f": "",
"g": ""
}
]'
declare @y nvarchar(max)
set @y='{"bac": ""}'
what I need is
'"pro": [
{
"a": "",
"b": "",
"c": "",
"address": {
"bac": ""
},
"e": "",
"f": "",
"g": ""
}
]'
March 14, 2022 at 7:34 am
Hi and good morning
Sorry but I dont know what is your goal?
Mayby you will insert something in IT? Then use placeholder for it.
example: your @x variable has inside a placeholder <<<bac>>> and <<<adress>>>.
With replace Statement you Put in what you need.
Set @z = replace (replace (@X,'<<<adress>>>' , @adress),'<<<bac>>>',@bac)
March 14, 2022 at 11:18 am
Can you explain the logic behind this requirement, please?
The absence of evidence is not evidence of absence
- Martin Rees
The absence of consumable DDL, sample data and desired results is, however, evidence of the absence of my response
- Phil Parkin
March 14, 2022 at 11:51 am
this can only be achieved using tsql json functions only
I masked them , I work on medical data
March 14, 2022 at 12:46 pm
this can only be achieved using tsql json functions only
I masked them , I work on medical data
Do you believe this to be a detailed and thorough response to my question?
The absence of evidence is not evidence of absence
- Martin Rees
The absence of consumable DDL, sample data and desired results is, however, evidence of the absence of my response
- Phil Parkin
March 14, 2022 at 1:27 pm
I know nothing of JSON, but this looks like it is doingwhat you are trying to do
https://docs.microsoft.com/en-us/sql/t-sql/functions/json-modify-transact-sql?view=sql-server-ver15
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply