I have a following JSON
{
"href": {
"host": "localhost",
"port": 2222
},
"name": "20190812",
"scheduledStartTime": "2019-08-12T12:22:52.500-04:00",
"parameters": {
"1251226": {
"value": {
"instanceID": 219002,
"productName": "product1",
"userID": "admin"
}
},
"1251287": {
"value": {
"sgName": "sg1",
"userID": "admin"
}
}
}
}
I want to iterate over the JSON and process the every iteration one by one. I tried using While giving the length of JSON as count, but couldn't figure out how to get values one by one
Is it even possible in SQL Server 2016?
I tried this so far
Declare @count INT
select @count = COUNT(*)
FROM OPENJSON((select template_data_mapping from template_data_mapping), N'$')
WHILE @count != 0
BEGIN
SELECT @count
SET @count = @count - 1;
END;