I've stumbled into rather an interesting and difficult problem. Assume I've got a table like with 3 columns:
id, which is VARCHAR(6)
a, which is VARCHAR(45)
b, which is VARCHAR(45)
I'm trying to generate a custom id of format AB0001, where A - first letter from a column; B - first letter from b column; the rest - 4 digits (possibly zerofill?) with auto-increment for each letter combination. My current approach would be assigning on insert trigger with a procedure to generate one, although is it possible to make it more simple and how?