I have to update value based on values from another table:
update OracleOb..NS.myTable set name = (select name from myTable1 where id = 1)
where id = 1
here the SQL has some problem. How can I get value from myTable1 and set it to myTable?
I am using MS SQL 2005.
Sorry I have to edit this question again. The table myTable is a linked object of Oracle table. I tried the suggested answer but I got error message:
The OLE DB provider "OraOLEDB.Oracle" for linked server "OracleOb" reported an error. The provider reported an unexpected catastrophic failure.
UPDATE m
SET m.name = m1.name
FROM MyTable m
JOIN MyTable1 m1 ON m.id = m1.id
WHERE m.id = 1
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With