Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How I can print the execution time of each query on messages Pane? For example the Select * from tbl1 runs for 10 mins then Select * from tbl2 runs for 15mins and so on..

Select * from tbl1
Select * from tbl2
Select * from tbl3
share|improve this question
SET STATISTICS TIME ON; – Aaron Bertrand Jul 9 '14 at 3:15
@Mark Surely, but it was just a comment, not an answer, sorry I didn't have time last night to be more thorough. – Aaron Bertrand Jul 9 '14 at 12:15
@AaronBertand Sorry! Wasn't criticising! – Mark Sinkinson Jul 9 '14 at 12:17
@Mark it's ok, you're right. For quick stuff it's probably good enough. – Aaron Bertrand Jul 9 '14 at 14:50

DATEDIFF will be useful

DECLARE @StartTime1 datetime 

SET @StartTime1 = GETDATE()

select query 1

SELECT ExecutionTimeInMS = DATEDIFF(millisecond, @StartTime1, getdate())


similarly do for other queries. @starttime2, 3

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.