Let's say I have an int with the value of 1. How can I convert that int to a zero padded string, such as 00000001
?
LPAD() function in MySQL is used to pad or add a string to the left side of the original string. The actual string which is to be padded. If the length of the original string is larger than the len parameter, this function removes the overfloating characters from string.
Declare @MyInt integer Set @MyInt = 123 Declare @StrLen TinyInt Set @StrLen = 8 Select Replace(Str(@MyInt, @StrLen), ' ' , '0')
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With