Is there a way to autoincrement the primary key (ID) as many digits as opposed to single digit (1, 2, 3)?
Printable View
Is there a way to autoincrement the primary key (ID) as many digits as opposed to single digit (1, 2, 3)?
Not from MySQL its self but you can set the field value directly form a PHP MySQL query :)Quote:
Originally Posted by vbbit
Cheers,
Ryan Jones
Are you using MySql 5? If so, you can do it using a trigger.
Could you provide a sample code? I mean just that section. and i don't know what version of mysql is
Mysql Query:
:)Code:SELECT VERSION();
It is 4.1.14-Max-log :(
Make your Primary key an integer without auto_increment and bfore inserting the record calulate the next vlaue, finds the largest value:
Code:// finde the largest id
SELECT MAX(id) FROM table;