i am new for mysql, here is my question i hope you guys will help me to resolve this. i want a query for update if record is less then 12 Charc and want to make it 12 char with starting 0 i.e i have record " 123456789123 " but if record is "123456789" where 3 char is missin from the starting means ( 000123456789 ) so i want to add 0 or 00 or 000 to make it 12 charc record. regards and thank in advanced for all.
use the lpad function update tablename set recordname = lpad(recordname,12,'0') where "anyfilter" Code (markup): reference http://dev.mysql.com/doc/refman/5.0/en/string-functions.html#function_lpad