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.
| Author |
Topic |
|
Kurmanc
Yak Posting Veteran
92 Posts |
Posted - 2009-04-28 : 08:01:18
|
HiIs tehre a way in SQL Server to update two tables simultaneously? I tried the following with no success. Any idea? UPDATE t1, t2 SET t1.productname= 'sony x3' ,t2.number = 5554 FROM table1 t1 INNER JOIN table2 t2 ON t1.id = t2.t1id WHERE t1.name= 'sony' |
|
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2009-04-28 : 08:14:58
|
| No, you'll have to do:UPDATE t1 SET Productname='sony x3'FROM table1 t1 INNER JOIN table2 t2 ON t1.id = t2.t1idWHERE t1.name= 'sony'UPDATE t2 SET number=5554FROM table1 t1 INNER JOIN table2 t2 ON t1.id = t2.t1idWHERE t1.name= 'sony' |
 |
|
|
Kurmanc
Yak Posting Veteran
92 Posts |
Posted - 2009-04-28 : 08:17:45
|
| robvolkI was afraid so. Thanks anyway. |
 |
|
|
|
|
|