View previous topic :: View next topic
|
Author |
Message |
RonaldCDcosta
New User
Joined: 06 Feb 2010 Posts: 3 Location: Canada
|
|
|
|
I need to fetch a number from a table and it must come with padded zeroes.
e.g: the table has numeric(5) and value 123.
Then after fetch the query must retuen 00123 and not 123.
How do I do this? |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
imbedded sql (in a program)
or a spufi/qmf query?
apparently, the column datatype is char???????
if the column is numeric, then the value of the column will be right justified,
zero filled to the left - for the length of the column as defined by the column attributes. |
|
Back to top |
|
|
RonaldCDcosta
New User
Joined: 06 Feb 2010 Posts: 3 Location: Canada
|
|
|
|
This is a spufi query and the column is numeric. |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
you can use a scalar function like digits (cast) |
|
Back to top |
|
|
RonaldCDcosta
New User
Joined: 06 Feb 2010 Posts: 3 Location: Canada
|
|
|
|
can you please write a small query using this function? I am not sure of the syntax. |
|
Back to top |
|
|
keane
New User
Joined: 24 Jul 2006 Posts: 11
|
|
|
|
Check this it will work for you
SELECT DIGITS(COLUMN NAME) FROM TABLE |
|
Back to top |
|
|
|