Re: automatically incrementing an int value

2003-03-12 Thread Benjamin Pflugmann
On Wed 2003-03-12 at 11:16:09 -0600, [EMAIL PROTECTED] wrote: > At 11:41 -0500 3/12/03, Douglas B. Jones wrote: > >Hi, > > > >I understood replace to only increment n when it matches the > >name value. In that case, you want a primary key on (name,n) with n being auto_increment. > There are 122,1

RE: automatically incrementing an int value

2003-03-12 Thread Keith C. Ivey
On 12 Mar 2003, at 11:41, Douglas B. Jones wrote: > INSERT INTO virus VALUES (3,'VBS/LoveLet-E'); > INSERT INTO virus VALUES (4,'VBS/LoveLet-G'); > INSERT INTO virus VALUES (5,'WM97/Myna-C'); > > I would have expected 3,4,5 to be 3,1,1. I was expecting it to start > from zero each time it got a n

RE: automatically incrementing an int value

2003-03-12 Thread Paul DuBois
At 11:45 -0500 3/12/03, Keith C. Ivey wrote: On 12 Mar 2003, at 10:22, Douglas B. Jones wrote: INSERT INTO virus VALUES (91207,'VBS/Kakworm'); INSERT INTO virus VALUES (117623,'VBS/Redlof-A'); As you can see, the numbers (n field) are way to high? Is this a bug in mysql or n the sql? It's far

Re: automatically incrementing an int value

2003-03-12 Thread Joseph Bueno
es, I could insert and do a count, but I was looking for another way so that the select would not be so resource expensive. Thanks, Cheers, Douglas -Original Message- From: Paul DuBois [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 12, 2003 11:29 AM To: [EMAIL PROTECTED]; [EMAIL PROTECTED

RE: automatically incrementing an int value

2003-03-12 Thread Paul DuBois
TECTED] Sent: Wednesday, March 12, 2003 11:29 AM To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Cc: [EMAIL PROTECTED]; Douglas B Jones Subject: RE: automatically incrementing an int value At 10:22 -0500 3/12/03, Douglas B. Jones wrote: Hi, I just tried the below: create table virus ( n int auto

RE: automatically incrementing an int value

2003-03-12 Thread Douglas B. Jones
: Douglas B Jones Subject: RE: automatically incrementing an int value On 12 Mar 2003, at 10:22, Douglas B. Jones wrote: > INSERT INTO virus VALUES (91207,'VBS/Kakworm'); > INSERT INTO virus VALUES (117623,'VBS/Redlof-A'); > > As you can see, the numbers (n field

RE: automatically incrementing an int value

2003-03-12 Thread Keith C. Ivey
On 12 Mar 2003, at 10:22, Douglas B. Jones wrote: > INSERT INTO virus VALUES (91207,'VBS/Kakworm'); > INSERT INTO virus VALUES (117623,'VBS/Redlof-A'); > > As you can see, the numbers (n field) are way to high? Is this a bug > in mysql or n the sql? It's far more likely to be a bug in your appli

RE: automatically incrementing an int value

2003-03-12 Thread Douglas B. Jones
ld not be so resource expensive. Thanks, Cheers, Douglas -Original Message- From: Paul DuBois [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 12, 2003 11:29 AM To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Cc: [EMAIL PROTECTED]; Douglas B Jones Subject: RE: automatically incrementing an int

RE: automatically incrementing an int value

2003-03-12 Thread Paul DuBois
At 10:22 -0500 3/12/03, Douglas B. Jones wrote: Hi, I just tried the below: create table virus ( n int auto_increment not null, name char(128) not null, primary key(n), unique(name(100)) ); with a data file that has 122,111 sql commands like: replace into virus va

RE: automatically incrementing an int value

2003-03-12 Thread Douglas B. Jones
TED] [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 12, 2003 10:58 AM To: [EMAIL PROTECTED] Cc: Douglas B Jones; [EMAIL PROTECTED]; 'Paul DuBois' Subject: RE: automatically incrementing an int value If I understand correctly, you are trying to grep the SQL data file. This is emphati

RE: automatically incrementing an int value

2003-03-12 Thread Alec . Cawley
If I understand correctly, you are trying to grep the SQL data file. This is emphatically not a valid thing to do. The data file is *not* a representation of the table displayed when you SELECT * from it. For a start, if you have deleted records and not overwritten them, the blank space will still

RE: automatically incrementing an int value

2003-03-12 Thread Douglas B. Jones
t I have tried destroying the table as well as the db, still get the same results. Any ideas? Thanks, Cheers, Douglas -Original Message- From: Paul DuBois [mailto:[EMAIL PROTECTED] Sent: Monday, March 10, 2003 11:14 AM To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Cc: [EMAIL PROTECTED]; Doug

RE: automatically incrementing an int value

2003-03-12 Thread Douglas B. Jones
l as the db, still get the same results. Any ideas? Thanks, Cheers, Douglas -----Original Message- From: Paul DuBois [mailto:[EMAIL PROTECTED] Sent: Monday, March 10, 2003 11:14 AM To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Cc: [EMAIL PROTECTED]; Douglas B Jones Subject: RE: automatically incr

RE: automatically incrementing an int value

2003-03-10 Thread Paul DuBois
0, 2003 10:36 AM To: Douglas B Jones Cc: [EMAIL PROTECTED] Subject: Re: automatically incrementing an int value As I read the manual, the REPLACE command will do what you want. Make the name field UNIQUE, and the number field AUTO_INCREMENT NOT NULL. Replace dos a delete-if-present

RE: automatically incrementing an int value

2003-03-10 Thread Douglas B. Jones
Cc: [EMAIL PROTECTED] > Subject: Re: automatically incrementing an int value > > > > As I read the manual, the REPLACE command will do what you want. > > Make the name field UNIQUE, and the number field AUTO_INCREMENT NOT NULL. > Replace dos a delete-if-present, insert. The

Re: automatically incrementing an int value

2003-03-10 Thread Alec . Cawley
As I read the manual, the REPLACE command will do what you want. Make the name field UNIQUE, and the number field AUTO_INCREMENT NOT NULL. Replace dos a delete-if-present, insert. The insert generates a new ID. See test below, and note two rows affected by second replace. mysql> create table te