"Director General: NEFACOMP" <[EMAIL PROTECTED]> wrote: > I think there is a bug in LPAD() function. > > Just try to run this query: > SELECT LPAD(12, 3, '0'); > This will correctly return 012 as expected. > > But when I run > SELECT LPAD(512, 3, '0'); > It doesn't return 512, instead it returns special characters. > > With that situation I tried the following > SELECT LPAD('512', 3, '0'); > And it worked as required. > > So, my conclusion will be that the type conversion will only take place when the > number of characters to PAD is bigger than the length of the original string.
What version do you use? Works like a charm for me: mysql> SELECT LPAD(12, 3, '0'); +------------------+ | LPAD(12, 3, '0') | +------------------+ | 012 | +------------------+ 1 row in set (0.00 sec) mysql> SELECT LPAD(512, 3, '0'); +-------------------+ | LPAD(512, 3, '0') | +-------------------+ | 512 | +-------------------+ 1 row in set (0.00 sec) -- For technical support contracts, goto https://order.mysql.com/?ref=ensita This email is sponsored by Ensita.net http://www.ensita.net/ __ ___ ___ ____ __ / |/ /_ __/ __/ __ \/ / Victoria Reznichenko / /|_/ / // /\ \/ /_/ / /__ [EMAIL PROTECTED] /_/ /_/\_, /___/\___\_\___/ MySQL AB / Ensita.net <___/ www.mysql.com -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]