Click here to Skip to main content
15,909,498 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hiii all,
i want to know how to display execution time of stored and display it . i tried:
SQL
declare @startproc datetime
declare @endproc datetime
declare @time integer
select @startproc = getdate()
exec  (my strored name)
select @endproc = getdate()
select @time = DATEDIFF(second, @startproc, @endproc)
print str(@time)


but it doesn't work..
any help........

thanks
Posted
Comments
Smithers-Jones 25-Sep-11 6:47am    
"It doesn't work" isn't helpful. Even my 5-year-nephew knows already, that if something doesn't work and he expects somebody to give him a solution, he has to describe the problem and how exactly it doesn't work.
moon2011 25-Sep-11 7:19am    
thanks alot, but i meant that the query doesn't appear any execution time however the stored executed sucessfully. is it clear now???????

1 solution

Have a look at this article[^] which present three ways for determining the execution time.

1. Using SQL Server Profiler
2. Using SQL Script with @StartTime and @EndTime parameters
3. Using SQL Script with SET STATISTICS TIME (Transact-SQL)
 
Share this answer
 
Comments
Sander Rossel 25-Sep-11 7:30am    
Correct, nice article :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900