common UPDATE syntax for SqlServer and Oracle

From: Jan van Veldhuizen <jan_at_van-veldhuizen.nl>
Date: Thu, 25 Nov 2004 23:44:54 +0100
Message-ID: <41a6603a$0$48933$e4fe514c_at_news.xs4all.nl>



The UPDATE table FROM syntax is not supported by Oracle.

I am looking for a syntax that is understood by both Oracle and SqlServer.

Example:

Table1:

id    name    city                city_id
1     john     newyork         null
2     peter    london            null
3     hans     newyork         null

Table2:

id city
23 london
24 paris
25 newyork

UPDATE table1
SET city_id = table2.id
FROM table1, table2
WHERE table1.city = Table2.city

If possible I do not want to have two different statements for Oracle and SqlServer

Please do not tell me that these tables are not normalized, it's just an example!

Thanks for any hints.

Jan van Veldhuizen Received on Thu Nov 25 2004 - 23:44:54 CET

Original text of this message