Poor man's SQL Profiling

While trying to nail down a perfomance issue, then execution plan was not really offering up any clues so I had to pull this out. Did what I needed, show the hog.

/* FOR DEBUG PURPOSES */
DECLARE @pStart DateTime, @pEnd DateTime, @pElasped INT, @pDebug bit
SELECT @pDebug = 1
/*
IF @pDebug = 1 SELECT @pStart = GetDate()

...Process to time....

IF @pDebug
BEGIN
SELECT @pEnd = GetDate(), @pElasped = DateDiff(ms,@pStart, @pEnd)
PRINT status + CONVERT(NVARCHAR,@pElasped)
END
*/

Comments :

0 comments to “Poor man's SQL Profiling”