I am trying to create a unique ID for each record based on the date of the record. For example, if today's record has been made, then I need a key of 20101130XX where there will be a series of numbers like XX 01, 02, 03 etc. If more than one person records a record today
If 3 people make records tomorrow, their unique ID will be
2011032700 2011032701 2011032702
And then midnight comes and makes a new record
2011032800
Its purpose is to give each record a unique ID that will be used in relation to the ticket.
We are already using date format, but currently user
I'm sure how to create a trigger to generate this kind of I unique ID And
from dev.mysql.com:
Mysam and BDB You can specify AUTO_INCREMENT at secondary column in multiple-column index in this situation, in AUTO_INCREMENT C The generated value for the MAX (auto_increment_column) + 1 is calculated as the WHERE prefix = gave prefix . This is useful when you want to put the data into groups ordered.
In this way, create 2 columns on the table, enter a date and a (auto_nertrated) ID, such as:
Create your table (date dated date zero, id INT No NULL AUTO_INCREMENT, name CHAR (30) faucet, primary key (dated, id)) engine = mice; If you do not use ISAM but InDebbi, then I think that you have to trigger your behavior which implements this behavior.
Comments
Post a Comment