Archive

Archive for the ‘MySQL’ Category

MySQL – convert string to auto increment number

SELECT
concat(
REPEAT( ‘0’ , ( LENGTH(‘00000’) – LENGTH(CAST(00009 AS UNSIGNED) + 1 ))),
CAST(00009 AS UNSIGNED) + 1
) as str;

Categories: MySQL Tags: