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 |
|
pwvailla
Starting Member
31 Posts |
Posted - 2010-09-21 : 17:43:07
|
| I am new to TSQL. I am trying to update a joined table and set values into the joined table if the values are present in the source table. I am converting some old SQL from a product called ARTEMIS and the OLD syntax is as follows:(joined table based on order_no field in each table and all fields are similar datatypes)set in table_A A (source)use table_B B set if order_no exists in table_B B.busunit = A.busunit if A.busunit present B.custname = A.custname if A.custname present B.model_code = A.model_code if A.model_code presentetc...How would you structure something like this using TSQL 2005? |
|
|
jimf
Master Smack Fu Yak Hacker
2875 Posts |
Posted - 2010-09-21 : 18:31:17
|
| Something like this?UPDATE BSET B.busunit = A.busunit ,B.custname = A.custnameetc.FROM table_B BINNER JOIN table_A AON B.order_no = A.order_noJim Everyday I learn something that somebody else already knew |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
|
|
|
|
|