there are different ways of doing this1.SET STATISTICS TIME ONthis will provide time taken along with resultsSET STATISTICS TIME ONGOSELECT * FROM TableWHERE field = conditionGO
and you will get time like:-SQL Server parse and compile time: CPU time = 0 ms, elapsed time = 1 ms.SQL Server parse and compile time: CPU time = 0 ms, elapsed time = 1 ms.2.You can also use SQL profiler to do this. Start the profiler and add the following events to traceSQL:StmtStarting :Transact-SQL statement has started. SQL:StmtCompleted :Transact-SQL statement has completed. SQL:BatchStarting :Transact-SQL batch has started. SQL:BatchCompleted :Transact-SQL batch has completed.and go to query analyser and execute the code.3. Another crude method is as followsDECLARE @StartTime datetime,@EndTime datetimeSELECT @StartTime= GETDATE()SELECT * FROM TableWHERE field = conditionSELECT @EndTime=GETDATE()SELECT DATEDIFF(ms,@StartTime,@EndTime) AS 'ExecutionTime'