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 |
|
Villanuev
Constraint Violating Yak Guru
478 Posts |
Posted - 2011-10-19 : 22:41:47
|
| Guys,I need to replace the records from MyTable2 of RMA_TYPE_ID.I will look the ESN from Mytable1 to Mytable2 if exist. if found i will replace RMA Type ID of MyTable2 by 10.how to make this in script. im trying to look for sample here in the forum but i coundnt found.i need your help guys.kindly modified this script. thanks.Select t1.esn, t1.rma_type_idfrom MyTable1 as t1left Outer Join Mytable2 as t2on t2.esn = t1.esnMYTABLE1ESN--RMA TYPE ID------------------000100005534710-10000100006163690-10000100007779690-10000100007928690-10MYTABLE2ESN--RMA_TYPE_ID------------------000100005534710--2000100006163690--2000100007779690--2000100007928690--2Thank you in Advance.Jonel |
|
|
Villanuev
Constraint Violating Yak Guru
478 Posts |
Posted - 2011-10-19 : 23:13:32
|
| I tried this script. it;s working. Update chrisMartin.dbo.ESNRMAsSET RMA_type_id=10where esn in ('000100005534710','000100006163690','000100007779690','000100007928690')and RMA_TYPE_ID='2' |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-10-20 : 00:23:49
|
so you want to look only for the above esns? the below would be more generic solnUPDATE t2SET t2.RMA_TYPE_ID = t1.RMA_TYPE_ID FROM MyTable1 as t1INNER Join Mytable2 as t2on t2.esn = t1.esn ------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
Villanuev
Constraint Violating Yak Guru
478 Posts |
Posted - 2011-10-20 : 00:47:59
|
| Thanks you. |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-10-20 : 01:01:45
|
| wc------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
|
|
|