Query for finding the Execution time of SPs

Query for finding the Execution time of SPs

DECLARE @V3 DATETIME
DECLARE @V1 DATETIME
DECLARE @V2 DATETIME
SET @V1= GETDATE()
SELECT CONVERT(TIME,@V1) START_TIME
EXEC SP_NAME @PARAM= ”
SET @v2=GETDATE()
SELECT CONVERT(TIME,@V2) END_TIME
SELECT @V3=@V2-@V1
SELECT CONVERT(TIME,@V3) DIFF

The above query will give an accurate result with start time,end time,execution time…..

Advertisement

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 )

Connecting to %s

Follow

Get every new post delivered to your Inbox.