Quantcast
Viewing all articles
Browse latest Browse all 16

Append 0’s in MySQL

In MySQL there is function to append character to string.

LPAD for left padding
LPAD(str,len,padstr)

RPAD for right padding

Example of usage

1
2
3
UPDATE sometable
SET FIELD = LPAD (FIELD,'5','00')
WHERE fieldid = 1

Viewing all articles
Browse latest Browse all 16

Trending Articles