Generally we use single statement to update multiple tables. Here I will explain SQL query to update multiple tables in SQL Server using inner joins.
Syntax to update multiple tables with inner join
Syntax to update multiple tables with inner join
UPDATE t1
SET t1.Name = 'Milan'
FROM Table1 t1 INNER JOIN Table2 t2
and t1.id = 10
UPDATE t2
SET t2.username = 'Patel'
FROM Table1 t1 INNER JOIN Table2 t2
ON t1.id = t2.id
and t1.id = 10
0 comments:
Post a Comment