ROUND / TRUNCATE WITH REMOVAL OF ZEROS

  • Hello,

    Is it possible to round and then truncate a number and then remove all of the zero's?

    PRINT ROUND(12.3456789, 4, 0)

    12.3500000

    PRINT ROUND(12.3456789, 4, 1)

    12.3400000

    The result I'm after is 12.35 (without the zeros).

    Thanks for any help in advance.

    -Marisa

  • take a look at cast and convert functions, they can manipulate the data into a decimal value with what ever precision you give it.

    EG

    PRINT CONVERT(DECIMAL(10,2),ROUND(12.3456789, 4, 0))

  • Thanks Anthony,

    I have some fairly complex statements and this works a treat.

    Cheers, Marisa

  • not to worry, always happy to help.

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply