)
Thanks
Emery
- Original Message -
From: "Mike Knox" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, October 17, 2003 09:44
Subject: RE: Check for data before inserting
Traditionally, I'd take the following approach
1) Update - assume it's there
2
EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Friday, October 17, 2003 15:44
Subject: Re: Check for data before inserting
> I didn't say it wouldn't.
> I was pointing out the danger of the method listed.
> Also, a danger with replace is that multiple records might be dele
imon Green wrote:
Why would the REPLACE statement not work?
Simon
(ps mite have missed some thing if so sorry)
-Original Message-
From: gerald_clark [mailto:[EMAIL PROTECTED]
Sent: 17 October 2003 14:08
To: Mike Knox
Cc: '[EMAIL PROTECTED]'
Subject: Re: Check for data before i
Why would the REPLACE statement not work?
Simon
(ps mite have missed some thing if so sorry)
-Original Message-
From: gerald_clark [mailto:[EMAIL PROTECTED]
Sent: 17 October 2003 14:08
To: Mike Knox
Cc: '[EMAIL PROTECTED]'
Subject: Re: Check for data before inserting
Mike
Mike Knox wrote:
Traditionally, I'd take the following approach
1) Update - assume it's there
2) If update fails (0 rows) do an insert
Thats assuming that the update case is more prevalent. If the row is
unlikely to be there - insert and do the update if you get a duplicate key.
You have to
primary key)
Thanks
Emery
- Original Message -
From: "Mike Knox" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, October 17, 2003 09:44
Subject: RE: Check for data before inserting
> Traditionally, I'd take the following approach
>
> 1) Updat
--Original Message-
From: Brent Baisley [mailto:[EMAIL PROTECTED]
Sent: 16 October 2003 19:29
To: Mike Tuller
Cc: MySql List
Subject: Re: Check for data before inserting
It sound like you want to use REPLACE instead of the SELECT and
INSERT/UPDATE combo. Replace will insert if the record doe
You are confusing the string function with the sql function.
Mike Tuller wrote:
Unless I am mistaken on REPLACE's use, I don't think that will work. The
example I have in the O'Reilly MySql book that I have shows this.
REPLACE(string, old, new)
Returns a string that has all occurances of the subs
actually it will act like insert in eather case. if its there,
delete it first, if not just insert.
http://www.mysql.com/doc/en/REPLACE.html
as far as using shell to do the insert/update, you could look at
command line php, that way you get the logic and you don't have to
learn a new language
s and then if there is a match, that row is updated, if
there is no match, then the data is inserted into a new row.
Mike
> From: Brent Baisley <[EMAIL PROTECTED]>
> Date: Thu, 16 Oct 2003 14:29:21 -0400
> To: Mike Tuller <[EMAIL PROTECTED]>
> Cc: MySql List <[EMAIL PROT
It sound like you want to use REPLACE instead of the SELECT and
INSERT/UPDATE combo. Replace will insert if the record doesn't exist
and update if it does.
On Thursday, October 16, 2003, at 01:27 PM, Mike Tuller wrote:
I have a shell script that I have data entered into a database, and
instead
11 matches
Mail list logo