calculating duration column in seconds

  • hi guys, i have an issue, i am trying to query my profiler results, to be specific my duration column, i am trying to conver from miliseconds to seconds, but my answer is not coming out correctly

    CAST(Duration/1000. AS decimal(8, 2)) AS [Duration (in Seconds)]

    when i match de begintime and endtime columns the answer is way off. can someone tell me why?

  • DBA (6/16/2008)


    hi guys, i have an issue, i am trying to query my profiler results, to be specific my duration column, i am trying to conver from miliseconds to seconds, but my answer is not coming out correctly

    CAST(Duration/1000. AS decimal(8, 2)) AS [Duration (in Seconds)]

    when i match de begintime and endtime columns the answer is way off. can someone tell me why?

    Duration in 2005 is recorded in "micro"seconds so you must divide by 1000000 😉


    * Noel

  • Thank you!!!

  • In a saved trace table for SQL Server 2005, only the duration is in microseconds. Duration is saved as microseconds regardless of the checked state of 'Show values in Duration column in microseconds (tools->options). In the sys.dm_exec_query_stats DMV, both the duration (total_elapsed_time) and CPU (total_worker_time) are in microseconds.

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

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