RE: update if insert fails

2004-04-23 Thread Dathan Vance Pattishall
You can use replace into, but note it cannot do Replace into table VALUES (1,2,3,col4+1); > -Original Message- > From: Andy Ford [mailto:[EMAIL PROTECTED] > Sent: Friday, April 23, 2004 3:59 AM > To: [EMAIL PROTECTED] > Subject: update if insert fails > > Hi > > Is there such a statem

RE: update if insert fails

2004-04-23 Thread Donny Simonton
months ago. This is definitely one of my favorite commands now. Donny > -Original Message- > From: B. Fongo [mailto:[EMAIL PROTECTED] > Sent: Friday, April 23, 2004 7:23 AM > To: 'Andy Ford'; [EMAIL PROTECTED] Mysql. Com > Subject: RE: update if insert fails

RE: update if insert fails

2004-04-23 Thread B. Fongo
Use REPLACE instead. It is similar to the INSERT except that, it will replace any old record that match - with the new one. A replace statement may look like this: REPLACE INTO TestTable (TestId, User) VALUES ("007","Bond"); HTH Babs ||> -Original Message- ||> From: Andy Ford [mailt

Re: update if insert fails

2004-04-23 Thread Victoria Reznichenko
Andy Ford <[EMAIL PROTECTED]> wrote: > > Is there such a statement where, if the insert fails (due to a duplicate > record) an update will happen > Take a look at REPLACE and INSERT .. ON DUPLICATE KEY UPDATE statements: http://dev.mysql.com/doc/mysql/en/REPLACE.html http://dev.m

Re: update if insert fails

2004-04-23 Thread Richard Davey
Hello Andy, Friday, April 23, 2004, 12:59:28 PM, you wrote: AF> Is there such a statement where, if the insert fails (due to a duplicate AF> record) an update will happen No, but you might want to look at REPLACE INTO to simulate this effect. -- Best regards, Richard Davey http://www.phpcomm