But another answer is to simply use TWO fields and then a VIEW when you SELECT from the table.
For example:
Code:
CREATE TABLE tickets_base (
prefix CHAR(4),
ticketcount INT AUTO_INCREMENT,
name VARCHAR(50),
PRIMARY KEY ( prefix, ticketcount )
);
And then
Code:
CREATE VIEW tickets
AS
SELECT CONCAT(prefix, RIGHT( CONVERT( 1000000 + ticketcount, CHAR ), 6 ) ) AS ticket, name
FROM tickets_base;
So when you add records, you always use INSERT into
ticket_base, for example
Code:
INSERT INTO tickets_base ( prefix, ticketcount, name )
VALUES( 'ABCD', NULL, 'Abigail Adams' );
But when you GET a record you always SELECT from the view:
Code:
SELECT * FROM tickets WHERE name LIKE 'Abigail%'
And that will return you
Code:
ABCD000073 Abigail Adams