Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 updating multiple tables with a single Update stmt

Author  Topic 

ktechf
Starting Member

7 Posts

Posted - 2011-10-23 : 07:57:10
Hi,

I just want to know if it is possible to upadte 2 or more tables with a single UPDATE statement.

If it is possible, could you please show me example.

Thanks

GilaMonster
Master Smack Fu Yak Hacker

4507 Posts

Posted - 2011-10-23 : 08:28:56
Nope. Inserts, updates and deletes have to target a single table.

--
Gail Shaw
SQL Server MVP
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-10-23 : 11:03:17
you can form a view out of tables and update through them. but please keep in mind that it has many restriction like you can update only one basetable columns at a time, you cant use aggregate functions etc.




------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-10-23 : 11:19:05
http://weblogs.sqlteam.com/brettk/archive/2008/04/03/60560.aspx

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -