I need MySQL to store numbers in a integer field and maintain leading zeros. I cannot use the zerofill option as my current field is Bigint(16) and numbers can vary in amoun
Keep the numbers stored as integers.
Then use function LPAD() to show the numbers (left) padded with zeros:
SELECT LPAD( 14, 7, '0') AS padded; | padded | ----------- | 0000014 |
If the number of zerofill characters is variable, add another column in the table with that (zerofill) length.