Round or Cast?

  • Hey guys, I want to select a value and only return 2 places after the decimal.

    I can do it but the problem is it rounds.

    select CAST('10.454873' as decimal (10,2))

    Returns 10.45 which is what I want.

    But if I change the 3rd decimal value to 5 or higher it returns 10.46.

    How can I return the exact 2 decimal places?

  • Don't worry I have the answer.

    Use Round:

    SELECT ROUND('10.456',2,1)

    This will return 10.45

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

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