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 |
|
Sun Foster
Aged Yak Warrior
515 Posts |
Posted - 2006-03-16 : 06:30:28
|
| There is a ORDER_L table in local server L need to compare with a table ORDER_R in remote server R and update it every day. There are about 500 records in ORDER_L.I need code to compare to do a job bellow: if ORDER_L.ORDER_ID = ORDER_R.ORDER_ID and ORDER_R.ORDER_CITY <> 'NEW YORK' then update ORDER_R.ORDER_CITY = 'NEW YORK'I knew how to use loop to do it. For learning, is there another way to do it? |
|
|
Lumbago
Norsk Yak Master
3271 Posts |
Posted - 2006-03-16 : 06:34:45
|
| UPDATE a SET a.ORDER_CITY = 'NEW YORK'FROM ORDER_R a INNER JOIN ORDER_L b ON a.ORDER_ID = b.ORDER_IDWHERE a.ORDER_CITY <> 'NEW YORK'--Lumbago"Real programmers don't document, if it was hard to write it should be hard to understand" |
 |
|
|
|
|
|