How to update two tables in one statement in SQL Server 2005?

后端 未结 9 1422
轻奢々
轻奢々 2020-11-22 05:45

I want to update two tables in one go. How do I do that in SQL Server 2005?

UPDATE 
  Table1, 
  Table2
SET 
  Table1.LastName=\'DR. XXXXXX\', 
  Table2.WApr         


        
9条回答
  •  旧时难觅i
    2020-11-22 06:13

    It is as simple as this query shown below.

    UPDATE 
      Table1 T1 join Table2 T2 on T1.id = T2.id
    SET 
      T1.LastName='DR. XXXXXX', 
      T2.WAprrs='start,stop'
    WHERE 
      T1.id = '010008'
    

提交回复
热议问题