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 |
|
SQLServerDBA_Dan
Aged Yak Warrior
752 Posts |
Posted - 2002-04-06 : 16:56:52
|
| If I have 2 tables that are joined;select a.col1, b.col1from table1 a inner join table2 b on (a.col1 = b.col1)How in the heck can I update both tables in a single update statement?MS Access would do something like:update Table1 inner join Table2 on (Table1.col1 = Table2.col1) inner join Table3 on (Table1.col2 = Table3.col1)set Table1.col1 = 'z', Table2.col1 = 'z'where Table3.col4 = noDanielSQL Server DBA |
|
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2002-04-06 : 17:05:23
|
| You can't. In SQL Server you can only update one table at a time. Also, if you try to update a view that consists of 2 or more tables, usually you can only update columns in one of the base tables. This may not be true if you are using partitioned views, as long as SQL Server can uniquely identify the rows being updated in each table. |
 |
|
|
SQLServerDBA_Dan
Aged Yak Warrior
752 Posts |
Posted - 2002-04-06 : 17:28:25
|
quote: You can't. In SQL Server you can only update one table at a time. Also, if you try to update a view that consists of 2 or more tables, usually you can only update columns in one of the base tables. This may not be true if you are using partitioned views, as long as SQL Server can uniquely identify the rows being updated in each table.
Thanks Rob... That really sucks that SQL cannot do something that Access can...DanielSQL Server DBA |
 |
|
|
smccreadie
Aged Yak Warrior
505 Posts |
Posted - 2002-04-06 : 19:50:12
|
| You might be able to use an update trigger to accomplish the same functionality. |
 |
|
|
|
|
|