mysql - How to add leading zeros into existing Column? -
mysql - How to add leading zeros into existing Column? -
i have 1 column (zip varchar(10)) in mysql. giving value examples of columns.
1. 576 2. 5768 3. 57689
i want replace 3 digits adding 00 prefix, 4 digits adding 0 prefix. after doing operation values should be,
1. 00576 2. 05768 3. 57689
is possible mysql query? ideas?
the next query uses lpad function suggested georstef.
update <tablename> set zip = lpad(zip,5,'0');
mysql sql
Comments
Post a Comment