Developing Matt

My Technical Journal

Time your query

leave a comment »

View statistics on the timing of your query with this.

SET STATISTICS TIME ON

DECLARE @a DATETIME, @b DATETIME
SET @a = CURRENT_TIMESTAMP
–Replace below with your query

–DECLARE @i INT
–SET @i = 0
–WHILE @i < 10000
–BEGIN
—    SET @i = @i + 1
–END

SET @b = CURRENT_TIMESTAMP
SELECT DATEDIFF(MS, @a, @b)
SET STATISTICS TIME OFF

Advertisements

Written by matt

November 28, 2007 at 1:22 pm

Posted in T-Sql

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: