How to import leading zeros in mysql db from phpmyadmin by ods

939 Views Asked by At

I have .ods ID column with leading zeros: 01344, 01345, 01222...
I formatted that column to category > text.

Ods file is imported via phpMyAdmin > import > from ods...

In table ID column is set like this: char(13) MIME: Text/Plain utf8_general_ci

Problem is that leading zeros are always missing. That's not good.

I tried enclosing ID values in '01344' and in "01344". That imported the value WITH quotation marks :(

Any ideas how to import leading zeros in mysql table?

1

There are 1 best solutions below

0
On

I have found one ugly solution:

Insert ' in front of all ID: '01344, '01345 ... save and import ods.
Delete ' from db with: UPDATE items SET ID = SUBSTR(ID, 2);

I hope there is better solution! If there is, please share it :)