SQL : Convert number w/decimal point to varchar - IBM AS400

This is a discussion on SQL : Convert number w/decimal point to varchar - IBM AS400 ; I feel dumb asking but anyway, what is the easiest way to convert a number with a decimal point to a string in SQL? I'm starting with a number like this 0002345.9800 and need it to be left justified and ...

+ Reply to Thread
Results 1 to 3 of 3

Thread: SQL : Convert number w/decimal point to varchar

  1. SQL : Convert number w/decimal point to varchar

    I feel dumb asking but anyway, what is the easiest way to convert a
    number with a decimal point to a string in SQL? I'm starting with a
    number like this 0002345.9800 and need it to be left justified and
    look like this 2345.98 in the varchar field.

    I don't see anything in the manual that will obviously do this.

    -Mike LaFountain


  2. Re: SQL : Convert number w/decimal point to varchar

    Perhaps one of the following?:
    varchar(decimal(0002345.9800 , 9, 2))
    varchar(decimal('0002345.9800' , 9, 2))

    Regards, Chuck
    --
    All comments provided "as is" with no warranties of any kind
    whatsoever and may not represent positions, strategies, nor views of my
    employer

    Mike LaFountain wrote:
    > I feel dumb asking but anyway, what is the easiest way to convert a
    > number with a decimal point to a string in SQL? I'm starting with a
    > number like this 0002345.9800 and need it to be left justified and
    > look like this 2345.98 in the varchar field.
    >
    > I don't see anything in the manual that will obviously do this.


  3. Re: SQL : Convert number w/decimal point to varchar

    Thanks Chuck, it works perfectly. I knew I was missing something
    simple.

    -Mike


+ Reply to Thread