Archive

Posts Tagged ‘mysql’

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;

Advertisements
Categories: MySQL Tags: