Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Auto-Increment Issue

Status
Not open for further replies.

gokeeffe

Programmer
Jan 11, 2005
170
IE
In the table you can see below I have an auto-increment value I use as my primary key, currently it increments starting at 1,2,3 and so on is there anyway that I can make it go FG01,FG02,FG03 on so on. I mean can the auto-increment value be set to a value of your choice

CREATE TABLE `grind_record` (
`grind_record_id` mediumint(8) unsigned NOT NULL auto_increment,
`user_id` mediumint(8) unsigned NOT NULL default '0',
`secondary_exam_id` tinyint(2) unsigned NOT NULL default '0',
`subject_id` tinyint(2) unsigned NOT NULL default '0',
`secondary_level_id` tinyint(2) unsigned NOT NULL default '0',
PRIMARY KEY (`grind_record_id`),
KEY `user_id` (`user_id`,`secondary_exam_id`,`subject_id`,`secondary_level_id`)
) TYPE=InnoDB COMMENT='Grind Records' AUTO_INCREMENT=61 ;

TKs
 
The primary key does not have to be an integer, but you can't make an autoincrement be anything but an integer. You shouldn't put any intelligence into your primary key, anyway.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top