Results 1 to 2 of 2
  1. #1
    Join Date
    Mar 2002
    Posts
    31

    Unanswered: Division operator

    I'm trying to perform a simple mathematical operation on an integer. The integer is the result of the COUNT() function, I need to divide this by a number, say 5, and then round up that number.

    For example, if the result of the operation was 52.4, it would become 53, if it were 52.6 it would be 53 and If it were 52, it would remain 52.

    Is this kind of functionality built in to T-SQL ?

    The main problem I'm having is that the result of COUNT(blah)/5 returns an integer, and ignores the remainder.

    Thanks,
    Paul

  2. #2
    Join Date
    Feb 2002
    Location
    Houston, TX
    Posts
    809
    If you look up "division" in BOL you will get a better understanding of what is happenig.

    you might try "cast(count(blah) as float)/5"
    Paul Young
    (Knowledge is power! Get some!)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •