Discussion:
Convert Integer to String, with Padding
(too old to reply)
p***@gmail.com
2014-02-14 18:39:12 UTC
Permalink
I have simple requirement of convert int to String..
is any H2 fuction provide the same?/
select replicate('0', 3 - len(rtrim(convert(char, <fieldname>)))) +
rtrim(convert(char, <fieldname>))
from <tablename>
I am trying to convert an integer value to a string, padding the left-side
of the string with 0's, via SQL. For example,
integer = 5 string = "005"
integer = 50 string = "050"
integer = 500 string = "500"
Does anyone know how to do this in SQL? I've had no luck with CONVERT or
STR.
Thanks.
--
Geoffrey J. Corb
The Winston Group
http://www.winstongroup.com
Erland Sommarskog
2014-02-14 18:53:36 UTC
Permalink
Post by p***@gmail.com
I have simple requirement of convert int to String..
is any H2 fuction provide the same?/
H2?
--
Erland Sommarskog, Stockholm, ***@sommarskog.se
Continue reading on narkive:
Loading...