Decimal conversion to Char.



Hi,
i have a req like :

Deciaml field need to be converted to char column.
For Ex:
123.45 +12345
-123.45 -12345

The Prob is when the decimal value is 00 i.e.,123.00 then the output is showing as +123
But i need to get the output as +12300.

Please help me how to handle this.

Thanks in advance.

Thanks,
Sreedhar

Return to forum:

Hi Sridhar.. Are you getting

Hi Sridhar..
Are you getting decimal field from Database or Flat File?
If flat file, read decimal as Varchar, then remove "." using ReplaceChr().
if source is database,

You can try the following
inputvalue : 123.00 or 123 --> multiply with 100 --> result :12300
inputvalue : 123.12 --> multiply with 100 --> result :12312
inputvalue : -123.00 or -123 --> multiply with 100 --> result :-12300
inputvalue : -123.12 --> multiply with 100 --> result :-12312

If there is no - in your output, you can concatenate +.

pls update your result...

--Prashant

Hi Prashant, Thanks for the

Hi Prashant,
Thanks for the quick reply.
My Source is DB.I think *100 Should work.
Thanks for the suggestion again.

Thanks,
Sreedhar

Hi Sridhar.. pls note

Hi Sridhar..
pls note that..
If your input value is less than 1, then *100 wont work...
then you should divide it with 100.
input value : -0.12 --> divided by 100 --> result: -.0012
input value : 0.12 --> divided by 100 --> result : .0012

So first check whether the input value and go forward with *100 or /100

--Prashant