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.
Author |
Topic |
allan8964
Posting Yak Master
249 Posts |
Posted - 2013-09-11 : 13:04:46
|
Hi there,I have about 20 scripts to run asexec script1 ...exec script20 I want to know how long does each of the script piece take. So how can I keep the records of time spent and save them as a file or save them into a table?Really appreciate your help! |
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
allan8964
Posting Yak Master
249 Posts |
Posted - 2013-09-11 : 22:57:33
|
It works this way. Any other ways, like using some functions? Thanks. |
|
|
Lumbago
Norsk Yak Master
3271 Posts |
Posted - 2013-09-12 : 03:19:04
|
[code]DECLARE @table table ( Procedure varchar(50), StartTime datetime, EndTime datetimeINSERT INTO @table VALUES ('Proc1', GETDATE(), NULL)EXEC Proc1UPDATE @table SET EndTime = GETDATE() WHERE Procedure = 'Proc1'INSERT INTO @table VALUES ('Proc2', GETDATE(), NULL)EXEC Proc2UPDATE @table SET EndTime = GETDATE() WHERE Procedure = 'Proc2'...SELECT * FROM @table[/code]- LumbagoMy blog-> http://thefirstsql.com |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2013-09-12 : 15:52:16
|
quote: Originally posted by allan8964 It works this way. Any other ways, like using some functions? Thanks.
sql profiler------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/https://www.facebook.com/VmBlogs |
|
|
|
|
|