joseph,

This was a feature that was recently modified.  Older versions of mySQL
support the 
feature that you seem to want.  3.23.xx and above will support the feature
that you 
have just described.  If you want to roll your own out,

you could do something like...

mysql> SELECT IFNULL(MAX(field) , 0) + 1 AS 'Auto Increment' FROM
newsStories;
+----------------+
| Auto Increment |
+----------------+
|           1096 |
+----------------+
1 row in set (0.01 sec)

Now let's say that you have a hundred records with an "ID" field enumerated
from 1-100.

If you went ahead and deleted 51-78, would you try to "reclaim" 51-78?  or
just continue 
from 100?

If you continue from 100, then the previous query should work.  Should you
try to "reclaim" 
51-78, that seems like a major hassle and I'd probably avoid it at all
costs.

HTH/my $0.02

chris



-----Original Message-----
From: Paulson, Joseph V. "Jay" [mailto:[EMAIL PROTECTED]]
Sent: Monday, April 02, 2001 2:46 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] easy db question


hello everyone-
I'm running MySQL 3.23.27-beta with php 4.04pl1.  What I am wondering is I
have an auto incrementing field and if I delete all the entries in the table
with this field the incrementing doesn't start over.  For example, if I
insert 6 records for the first time into this table the auto incremenator
gets set to 6 for the last position.  Now, if I go and delete all 6 of these
entries and then insert 6 more after the deletion the auto incrementing
starts off at 7 and goes through 12.  I'm just curious if there is a way
around this so that if all the records are deleted the auto incrementing
field will start back at 1.

Thanks,
Jay Paulson
Developer, Web Technologies
Viatel, Inc.
http://www.viatel.com

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to