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 2000 Forums
 Transact-SQL (2000)
 Updating 2 or + tables

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2002-08-05 : 08:25:17
Teo writes "How to update 2 tables whit follow select...

UPDATE TABLE1 T1, TABLE2 T2
SET T1.FIELD1 = T2.FIELDx
WHERE T1.FIELDy = T2.FIELDz

or

UPDATE TABLE1 T1, TABLE2 T2 , TABLE T3
SET T1.FIELD1 = T3.FIELDn

WHERE T1.FIELDy = T2.FIELDz
AND T1.FIELDy = T3.FIELDz
AND T2.FIELDz = T3.FIELDz


Tank you for some help about this

Teo"

Page47
Master Smack Fu Yak Hacker

2878 Posts

Posted - 2002-08-05 : 08:50:57
The INSERT, UPDATE and DELETE DML can only effect one table at a time. If you need to update 3 tables, you need three mutually exclusive UPDATE statements.

Jay White
{0}
Go to Top of Page
   

- Advertisement -