I just wanna make it Sure if more than one auto_increment field can be created or not as far I know the Answer Is no . Nut I Wanna make sur about it
Plase Anwer
EDIT : OOPS Sorry Spelling mistake
multiple auto_incremented field
Moderator: General Moderators
- neel_basu
- Forum Contributor
- Posts: 454
- Joined: Wed Dec 06, 2006 9:33 am
- Location: Picnic Garden, Kolkata, India
multiple auto_incremented field
Last edited by neel_basu on Thu Jan 25, 2007 3:49 am, edited 1 time in total.
- neel_basu
- Forum Contributor
- Posts: 454
- Joined: Wed Dec 06, 2006 9:33 am
- Location: Picnic Garden, Kolkata, India
Ya I've Tried It.feyd wrote:Spell check.
Why not try it and find out?
It Shows
Error Number 1075mysql_error() wrote:Incorrect table definition; there can be only one auto column and it must be defined as a key
I've visited therevolka wrote:see http://dev.mysql.com/doc/refman/5.1/en/ ... table.html
------------------------------------------------------------------------------------------------http://dev.mysql.com/doc/refman/5.1/en/create-table.html wrote:AUTO_INCREMENT
The initial AUTO_INCREMENT value for the table. In MySQL 5.1, this works for MyISAM, MEMORY, and InnoDB tables. To set the first auto-increment value for engines that do not support the AUTO_INCREMENT table option, insert a “dummy” row with a value one less than the desired value after creating the table, and then delete the dummy row.
For engines that support the AUTO_INCREMENT table option in CREATE TABLE statements, you can also use ALTER TABLE tbl_name AUTO_INCREMENT = N to reset the AUTO_INCREMENT value.
But Does it mean only one auto_increment is possible ??
not necessarily, but
doeshttp://dev.mysql.com/doc/refman/5.1/en/create-table.html wrote:Note: There can be only one AUTO_INCREMENT column per table, it must be indexed, and it cannot have a DEFAULT value.