December 2013
Intermediate to advanced
1872 pages
153h 31m
English
Although the STATISTICS TIME option works fine for displaying the runtime of a single query, it is not as useful for displaying the total elapsed time for a stored procedure. The STATISTICS TIME option generates time statistics for every command executed within the stored procedure. This makes it difficult to read the output, and you would have to add them all up to determine the total elapsed time for the entire stored procedure.
Another way to display runtime for a stored procedure is to capture the current system time right before it starts, capture the current system time as it completes, and display the difference between the two, specifying the appropriate-sized datepart parameter to the datediff() function, ...