round

  • Is there a funcion in sql server 2005 to obtain this result?

    For a number =0,55 I want to have 1

    For a number =0,45 I want to have 0

    For all numbers with decimals >=0,5 I want to simulate ceiling(number) and for the numbers with decimals<0,5 I want to simulate floor(number)

  • antonela (6/20/2014)


    Is there a funcion in sql server 2005 to obtain this result?

    For a number =0,55 I want to have 1

    For a number =0,45 I want to have 0

    For all numbers with decimals >=0,5 I want to simulate ceiling(number) and for the numbers with decimals<0,5 I want to simulate floor(number)

    The round function!

    😎

    DECLARE @FL_055 FLOAT = 0.55;

    DECLARE @FL_045 FLOAT = 0.45;

    SELECT ROUND(@FL_055,0) AS R_UP

    SELECT ROUND(@FL_045,0) AS R_DOWN

  • thanks, it was so simple....

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

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