--- [EMAIL PROTECTED] wrote: > Joe Wilson <[EMAIL PROTECTED]> wrote: > > Is UPDATE OR REPLACE always equivalent to just UPDATE? > > No. UPDATE is the same as UPDATE OR ABORT. Try replacing > the UPDATE OR REPLACE in the following script with just > UPDATE to see the difference: > > CREATE TABLE t1(x UNIQUE, y); > INSERT INTO t1 VALUES(1,2); > INSERT INTO t1 VALUES(3,4); > > UPDATE OR REPLACE t1 SET x=3 WHERE y=2; > SELECT * FROM t1;
Thanks. That's quite useful, actually. I used to do a DELETE followed by an INSERT in this situation. The UDPATE OR REPLACE construct is more efficient. Does anyone know whether UPDATE OR REPLACE is portable to any other popular database? (Oracle, SQL Server, MySQL, Postgres) REPLACE() seems to be a string function in other databases. ____________________________________________________________________________________ Yahoo! Music Unlimited Access over 1 million songs. http://music.yahoo.com/unlimited ----------------------------------------------------------------------------- To unsubscribe, send email to [EMAIL PROTECTED] -----------------------------------------------------------------------------