Query Result with SET STATISTICS

1

I wanted to know if I could get the "SET STATISTICS TIME ON" result. For example, the result of my query gave 1139ms. Can I get this result and manipulate it? Convert to seconds, minutes, write to a table ...

    
asked by anonymous 17.03.2016 / 14:41

1 answer

3

I do not think it's possible, in any case you'll 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.
    
17.03.2016 / 15:28