是否可以找出谁调用了存储过程?我正在使用以下查询来确定执行计数等,但我无法确定哪个作业/触发器/进程正在调用它。请问有什么想法吗?
SELECT
a.execution_count, OBJECT_NAME(objectid) Name,
(CASE WHEN a.statement_end_offset = -1
THEN LEN(CONVERT(nvarchar(max), b.text)) * 2
ELSE a.statement_end_offset
END - a.statement_start_offset) / 2),
b.dbid, dbname = db_name(b.dbid), b.objectid,
a.creation_time, a.last_execution_time, a.*
FROM
sys.dm_exec_query_stats a
CROSS APPLY
sys.dm_exec_sql_text(a.sql_handle) AS b
WHERE
OBJECT_NAME(objectid) = 'Rebuild_Indexes'
ORDER BY
a.last_execution_time
ESCquery_text = SUBSTRING(b.text,a.statement_start_offset/2,