August 2, 2016 at 7:18 am
Hi,
I have the below SQL statement
select
CONVERT(TIME, DATEADD(SECOND, DATEDIFF(SECOND, last_request_start_time, GETDATE()), 0), 114) AS Duration,
* from sys.dm_exec_sessions
where (status <> 'sleeping' or open_transaction_count > 0)
order by last_request_end_time
Duration session_id ...
00:00:00.0000000139 ...
The duration if it is less than one second, it will always show 00:00:00.0000000. How can I show the MILLISECOND value like 00 00:00:00.050 ?
Thanks,
August 2, 2016 at 7:46 am
Just a stab here but does this work?
select
CONVERT(TIME, DATEADD(ms, DATEDIFF(ms, last_request_start_time, GETDATE()), 0), 114) AS Duration,
*
from sys.dm_exec_sessions
where (status <> 'sleeping' or open_transaction_count > 0)
order by last_request_end_time
August 2, 2016 at 8:47 am
Y.B. (8/2/2016)
Just a stab here but does this work?
select
CONVERT(TIME, DATEADD(ms, DATEDIFF(ms, last_request_start_time, GETDATE()), 0), 114) AS Duration,
*
from sys.dm_exec_sessions
where (status <> 'sleeping' or open_transaction_count > 0)
order by last_request_end_time
Thank you very much!
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply