Query execution information of SQL Server Stored Procedures

Source: Internet
Author: User
View Code create view view_job_info
Select B. [name] [job name], case when B. Enabled = 1 then' enable 'else' disable 'end [Enable]
, A. step_name [step name], A. Command
From MSDB. DBO. sysjobsteps a inner join
MSDB. DBO. sysjobs B on A. job_id = B. job_id

Select B .*,
Object_name (object_id, database_id) stored procedure name,
D. cached_time: the last execution time (ms) of D. last_execution_time,
D. total_elapsed_time/1000 total time spent in MS,
D. total_elapsed_time/d.exe cution_count * 1000 as average execution time ms,
D. last_elapsed_time: last execution time (MS), d.exe cution_count: number of executions
From SYS. dm_exec_procedure_stats as D inner join view_job_info B on B. Command like

'%' + Object_name (object_id, database_id) + '%'
Where object_name (object_id, database_id) in (Select name from SYS. objects where
Type = 'P'
And modify_date> '2017-2-24 17:32:50 ')
Order by 6 DESC;

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.