Rajgopal,
The above query will give you the total time the query spent on the system (including active time and delay time). If you want to calculate the total Active Execution Time of the query on the system (this will not include the time it spent in the delay state), you can use:
SELECT ( ( firstresptime - firststeptime ) HOUR( 4 ) TO SECOND( 2 ) ) AS ExecutionTime
Rajgopal,
The above query will give you the total time the query spent on the system (including active time and delay time). If you want to calculate the total Active Execution Time of the query on the system (this will not include the time it spent in the delay state), you can use: