Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 4 of 4 total
Thread AutoInc Reset?
Wed, Feb 6 2008 4:52 PMPermanent Link

"Andrej Bivic"
I have a table with a AutoInc field. Every morning I insert 55000 records
and at the end of the day I delete all of them (delete from table1). I am
afraid, that AutoInc will rise to high. Is there a way, I can reset that
AutoInc?
please advise,
Andrej

Wed, Feb 6 2008 10:02 PMPermanent Link

Fernando Dias

Team Elevate Team Elevate

Andrej,

The maximum value for Autoinc is 2147483647, so if you started at 0 and
you are going to add 55000 record a day, you may add records for
2147483647 DIV 55000 = 39045 days (about 106 years)  Smile
Even so, if you want to reset the Autoinc, you may use the following SQL:

ALTER TABLE <YourTableName>
REDEFINE <YourAutoIncColumnName> LAST AUTOINC 0;

Best regards
--
Fernando Dias
Easygate, Lda
Fri, Feb 8 2008 8:27 PMPermanent Link

Stuart Kelly
Hi, Andrej

> Is there a way, I can reset that AutoInc?

I think emptying the table, rather than deleting the records, will reset the auto
increment to zero.

EMPTY TABLE table_name

Stu


Mon, Feb 11 2008 3:52 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Stuart,

<< I think emptying the table, rather than deleting the records, will reset
the auto increment to zero.

EMPTY TABLE table_name >>

Yes, you are correct also.

--
Tim Young
Elevate Software
www.elevatesoft.com

Image