473,386 Members | 1,795 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Reinitializing an autoincrement column

i have been working on a project with an autoincrement column. as i tested continually, the increments reached about 2500. now, with the project finished, how do i reset the autoincrement counter back to zero? even if i erase all my data in the tables, the autoincrement keeps on counting higher than 2500. how do i get it back to zero?

thanks!

PS. im using phpmyadmin, if that's any help
Apr 9 '08 #1
4 2036
Markus
6,050 Expert 4TB
Helle there!

You can use this:
[php]
ALTER TABLE `table_name`
AUTO_INCREMENT = 0
[/php]

Cheers :)
Apr 9 '08 #2
ronverdonk
4,258 Expert 4TB
This is NOT a php question, but a MySQL one. I will move this thread.\ to the MySQL forum.

moderator
Apr 9 '08 #3
Hi,

if you want to delete all the records from the table, user the tuncate statement to delete all the records. It will delete all ur records and automatically rest ur auto increment value. Otherwise you have to rest the value manually by the alter table statement.


Ex:

TRUNACATE TABLE <table_name>;

else

use the above method.


Regards,
S.Ashokkumar
Apr 9 '08 #4
This is NOT a php question, but a MySQL one. I will move this thread.\ to the MySQL forum.

moderator
oh, okay, im sorry. you could delete this now. problem solved.. ^_^

thanks for those who helped out
Apr 11 '08 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: jaYPee | last post by:
I have a table in my sqlserver 2000 that has a field IDNO. i want this field to be my primary key. however i don't want this field to use the autoincrement feature. when i access this table from...
0
by: Marko Maehner | last post by:
Hi, I have a strange problem with my xml file. In the schema of this xml file I have set one column to autoincrement. When I enter the data in my xml file directly, the autoincrement-column gets...
0
by: Neil | last post by:
Hi, I'm getting some strange results using the autoincrement column on my datatable. I'm populating a datatable with data from my database and displaying this in a datagrid. The first time I get...
0
by: Agnes | last post by:
I got master-detail relationship grid. in my detail grid, i set the column ..autoincrement. that grid contains serveral column.1st column is description. 1)the user input 2rows. and then press'...
6
by: Dennis | last post by:
I have set a DataTable and one of the columns I set "AutoIncrement" to True. I then populate the Table by setting the columns to values then add the row to the table. I inadverently set the...
1
by: Sam | last post by:
Hi all I have a simple datagrid form which has 4 columns. The first one is used just like a key and the other threes allow user to enter numbers. The problem that I am having is that when I...
6
by: Michael | last post by:
I am trying to create an access database within Net 2003 using the ADOX library which works fine except when I try to add the AutoIncrement property to the ContactId column. I am experiencing a...
5
by: JC Voon | last post by:
Hi: How to reset the autoincrement value generated by DataTable ? I've master and detail table, the detail table has a autoincrement column, each time i add a new master record, i need to...
1
rizwan6feb
by: rizwan6feb | last post by:
I have a DataTable with thousands of records, i want to show these records on per page basis ( i.e a DataGridView showing first 20 records and next button to show next 20 records ...) To achieve...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.