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 2005 Forums
 Transact-SQL (2005)
 UPDATE MULTIPLE TABLES

Author  Topic 

swathigardas
Posting Yak Master

149 Posts

Posted - 2008-10-10 : 02:22:42
hi,
Is there any query to update multiple tables..
I need a quary something like this.

update table1,
table2,
table3

set table1.column1= value1
table1.column2= value2
table1.column3= value3
table2.column1=value4
table2.column2=value5
table2.column3=value6
table3.column1=value7
table3.column2=value7
table3.column3=value8


I need this query coz i need to update multiple tables.

please help me out in this.

Thanks before hand

-Swathi

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-10-10 : 03:05:54
Nope. no direct query. either use three update statements to update each table or create a view including the three tables and update the view.

http://weblogs.sqlteam.com/brettk/archive/2008/04/03/60560.aspx
Go to Top of Page

swathigardas
Posting Yak Master

149 Posts

Posted - 2008-10-10 : 03:09:46
ok vishakh..
Thanks anyways
Go to Top of Page
   

- Advertisement -