Auto -Increment issue

I need auto-increment value like that ABSE00001 to ABSE00100 this value increment based on database last increment value like ABSE00001 ,next value ABSE00002

Any Body know this type increment Kindly Reply me.


Is the prefix always ABSE, or does that change when the number reaches 99999? You could split the auto-increment to one column so that the database does that for you, then add the alpha portion from another source.

ABSE Dynamic value For example: ABSE00001 ,next batch no start ATFF00001

Do you have any reference link kindly send me

Or send me a runnable code

I can’t think of a way that just assigning auto-increment to a column is going to be able to cope with knowing that when the ABSE prefix is no longer correct, it should go to ATFF. I could see a relatively easy way to make it jump to ABSF, then ABSG.

All I can suggest is that you have a table containing the sequence of batch codes and when a new batch is required, handle it manually.

I didn’t find it explicitly stated in the documentation, but AFAIK AUTO_INCREMENT works only with Integer datatypes.

It might be possible to use CONCAT somehow, but even then the alphabetic prefixes and and numeric portions of the field would need to dealt with separately.

or just insert all IDs first.

I Have a solution for this topic:

$count = $student_id+1;
$valid_student_id = str_pad($count, 5, “0”, STR_PAD_LEFT);
$valid_student_id = “0000001”;

The ABSE/ATFF part is completely missing.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.