Hi,
I have a table that contains integers. I need to left pad the integers with blanks and a length of 5 characters.
E.g. Table contains following integers (data type is integer).
CustKey (column)
1
2
3
In SQL, I used the LPAD function - LPAD(CustKey, 5, ' '). However, this does not add the spaces in front. It just returns the integers in the same way as the original table.
However, if I used LPAD(CustKey, 5, '0') then the query correctly returns:
00001
00002
00003
However, I want the spaces - not the 0s.
Do I need to convert CustKey to a string first? What function would you use for that?
Thanks
Sunil