add batch remove batch split batch comment selection show hidden batches hide batch highlight batch
db<>fiddle
donate feedback about
By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0.
CREATE TABLE X (ID INT, FromID INT, ToID INT)
INSERT INTO X VALUES (1, 10, 12),
(2, 42, 17),
(3, 100, 1)

DECLARE @RelationshipType NVARCHAR(MAX) = N'{
"RelationshipType" : [
{
"ID" : 1,
"FromID" : 70,
"ToID" : 12
},
{
"ID" : 3,
"FromID" : 80,
"ToID" : 1
}
]
}'

SELECT * FROM X

UPDATE U
SET FromID = J.FromID
FROM X AS U
JOIN OPENJSON(@RelationshipType, '$.RelationshipType')
WITH (ID INT, FromID INT, ToID INT) J
ON J.ID = U.ID

SELECT * FROM X

DROP TABLE X
ID FromID ToID
1 10 12
2 42 17
3 100 1
ID FromID ToID
1 70 12
2 42 17
3 80 1