Whats the next whole number?

  • I have some results from my Select where the values are

    1.00000.083333.333332

    2.00000.166666.666664

    1.00000.083333.333332

    1.00000.083333.333332

    1.00000.083333.333332

    1.00000.083333.333332

    1.00000.083333.333332

    10.0000.8333333.333332

    (3 columns)

    I need to take the middle column and round it "up" to the next whole value so for example .083 would be 1 and so would .833 because these represent actual objects,

    10 objects divided by 12 mathematically = .83 but object wise would be 1, and * 4 would equal 4 not 3.33 (even tho mathematically it equates that way)

    any ideas? thanks

    -- Francisco

  • Use the Ceiling() function. It rounds up to the next whole number. Floor() always rounds down to the next number.


    My blog: SQL Soldier[/url]
    SQL Server Best Practices:
    SQL Server Best Practices
    Twitter: @SQLSoldier
    My book: Pro SQL Server 2008 Mirroring[/url]
    Microsoft Certified Master: SQL Server, Data Platform MVP
    Database Engineer at BlueMountain Capital Management[/url]

  • Thank you very much for your quick reply , this answer never even dawned on me

    -- Francisco

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

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