Converting Decimal to String W/O Decimal Point

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • JD

    Converting Decimal to String W/O Decimal Point

    I'd like to convert a Decimal value into a string so that the entire
    original value and length remains intact but there is no decimal point.

    For example, the decimal value 6.250 is selected as 06250.

    Can this be done?

  • JW

    #2
    Re: Converting Decimal to String W/O Decimal Point

    select replace(cast (6.250 as varchar),'.','' )

    JD wrote:[color=blue]
    > I'd like to convert a Decimal value into a string so that the entire
    > original value and length remains intact but there is no decimal[/color]
    point.[color=blue]
    >
    > For example, the decimal value 6.250 is selected as 06250.
    >
    > Can this be done?[/color]

    Comment

    • JW

      #3
      Re: Converting Decimal to String W/O Decimal Point

      select replace(cast (6.250 as varchar),'.','' )

      Comment

      • JW

        #4
        Re: Converting Decimal to String W/O Decimal Point

        but length doesn't remain intact

        Comment

        • JW

          #5
          Re: Converting Decimal to String W/O Decimal Point

          but length doesn't remain intact

          Comment

          • JW

            #6
            Re: Converting Decimal to String W/O Decimal Point

            select replace(space(1 )+replace(cast (6.250 as varchar),'.','' ),' ','0')

            Comment

            • JD

              #7
              Re: Converting Decimal to String W/O Decimal Point

              Thanks!!!

              Comment

              Working...