Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Calculating query running time...

Author  Topic 

ZarrinPour
Yak Posting Veteran

66 Posts

Posted - 2007-12-19 : 22:49:37
Hi all
As you know when you run a piece of TSQL scrypt in Query Analizer
at the bottom of the page , sql-server will show you the Time of completion of your code....is there any way to capture this time
from SQL-Server environment and use it in the Front-End Application
to inform the user?

Kind regards.

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2007-12-19 : 22:54:23
use getdate() to capture the start and end time and use datediff() to find the different


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2007-12-20 : 01:34:35
Declare @start datetime
set @start=getdate()
--run query
select datediff(second,@start,getdate()) as no_of_seconds

You can also simulate this in your front end application

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -