Query result with SET STATISTICS

Asked

Viewed 45 times

1

I was wondering if there’s any way I could get the results of "SET STATISTICS TIME ON". For example, the result of my query gave 1139ms. Is there any way I can get this result and manipulate it? Convert to seconds, minutes, write to a table...

inserir a descrição da imagem aqui

1 answer

3


do not believe it is possible, in any case you will achieve the same result by manipulating two variables.

DECLARE @ExecInicio DATETIME2(7)
DECLARE @ExecTermino DATETIME2(7)

SET @ExecInicio = sysdatetime();

-- MinhaQuery

SET @ExecTermino = sysdatetime();

SELECT DATEDIFF(SECOND, @ExecInicio, @ExecTermino) -- segundos.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.