| Author |
Topic |
|
GhantaBro
Posting Yak Master
215 Posts |
Posted - 2009-01-27 : 21:31:01
|
| Hey Guys,I need to find how long a Stored Procedure ran last 5 times it was executed in sql 2005? The SP had logs but we had truncated the log earlier and need this now... Any help is appreciated.Thanks |
|
|
AvanthaSiriwardana
Yak Posting Veteran
78 Posts |
Posted - 2009-01-27 : 22:10:37
|
| you can go to executin plan and see, for how long your sp ran.but normally when you run a SP inside the mgt studio it shows the execution time underneath the bar.Avantha Siriwardana |
 |
|
|
GhantaBro
Posting Yak Master
215 Posts |
Posted - 2009-01-27 : 22:33:11
|
| What about the time it ran a month back? |
 |
|
|
AvanthaSiriwardana
Yak Posting Veteran
78 Posts |
Posted - 2009-01-27 : 22:39:23
|
| you mean you wanna see the execution plan for a given date and time? isn't it??Avantha Siriwardana |
 |
|
|
sodeep
Master Smack Fu Yak Hacker
7174 Posts |
Posted - 2009-01-27 : 22:40:57
|
| [code]SELECT OBJECT_NAME(sys.dm_exec_sql_text.objectid), sys.dm_exec_query_stats.* FROM sys.dm_exec_query_stats CROSS APPLY sys.dm_exec_sql_text(sys.dm_exec_query_stats.sql_handle) WHERE sys.dm_exec_sql_text.dbid = db_id() AND OBJECT_NAME(sys.dm_exec_sql_text.objectid) = 'yoursp' [/code] |
 |
|
|
AvanthaSiriwardana
Yak Posting Veteran
78 Posts |
Posted - 2009-01-27 : 22:53:41
|
| sodeeps code does not give detials when it ran a month back?? isn't it? :)Avantha Siriwardana |
 |
|
|
GhantaBro
Posting Yak Master
215 Posts |
Posted - 2009-01-27 : 22:59:52
|
| yeah it did not... |
 |
|
|
AvanthaSiriwardana
Yak Posting Veteran
78 Posts |
Posted - 2009-01-27 : 23:08:57
|
| im not sure whether you will be able to get exact detils for a given date and time..but give me somtime and i will try to come up with a solution. okAvantha Siriwardana |
 |
|
|
GhantaBro
Posting Yak Master
215 Posts |
Posted - 2009-01-27 : 23:10:33
|
| thanks a lot Avantha. |
 |
|
|
AvanthaSiriwardana
Yak Posting Veteran
78 Posts |
Posted - 2009-01-28 : 00:55:13
|
| no prob:)Avantha Siriwardana |
 |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
|
AvanthaSiriwardana
Yak Posting Veteran
78 Posts |
Posted - 2009-01-28 : 01:13:47
|
| yes tkizer is correct.the thing is unless you have recorded those transactions. that is in a log or a table.Avantha Siriwardana |
 |
|
|
GhantaBro
Posting Yak Master
215 Posts |
Posted - 2009-01-28 : 01:28:44
|
| Thanks guys. |
 |
|
|
|