Rounding or Truncation with DATEDIFF to the seconds level

  • PLEASE IGNORE THIS POSTING. IF FIXED MY PROBLEM. I DON'T KNOW HOW TO DELETE THE POST. SORRY:ermm:

    I am creating a data set in sql that has the number of minutes between two dates. The dates go to the seconds level. I started out with DATEDIFF(MINUTE,DATE1,DATE2) and noticed that it was returning data that didn't match the original source (i.e. I had 1 minute and the source had 2 minutes.). So I figured it must be that I used MINUTE instead of SECOND divided by 60. I changed my code to DATEDIFF(SECOND,DATE1,DATE2)/60.00 but am still getting whole minutes. The table into which this data is being put has the column defined as NUMERIC(18,2). I have also tried this using a column definition of FLOAT. But no matter what I do I am getting whole minutes. I am getting 1 instead of 1.54 minutes.

    What am I doing incorrectly?

    PS: If this has already been addressed somewhere else, I apologize. I did search for it but couldn't find anything on the site.

Viewing 0 posts

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