sql 查找最近未运行的sprocs

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sql 查找最近未运行的sprocs相关的知识,希望对你有一定的参考价值。

set transaction isolation level snapshot

use hub_200

;with RecentlyExecutedStoredProcedures as (
    select
        (select name from sys.schemas where "schema_id" = sys.objects."schema_id") + '.' + "Name" as RecentlyUsedStoredProcedure
    from sys.objects
    where "object_id" in (select "object_id" from sys.dm_exec_procedure_stats stats)
),
AllStoredProcedures as (
    select
        (select name from sys.schemas where "schema_id" = sys.objects."schema_id") + '.' + "Name" as StoredProcedure
    from sys.objects
    where type_desc = 'SQL_STORED_PROCEDURE'
)
select * from AllStoredProcedures
except
select * from RecentlyExecutedStoredProcedures
order by StoredProcedure

以上是关于sql 查找最近未运行的sprocs的主要内容,如果未能解决你的问题,请参考以下文章