是否有可能找出调用存储过程的人?我使用以下查询来识别执行次数等,但无法确定是哪个作业/触发器/进程在调用它。请问有什么想法吗?
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,
@@SPID
和ORIGINAL_LOGIN()
可用。您想通过键盘查看指纹并查看谁_真正_启动了应用程序吗?select * from sys.dm_exec_connections as EC inner join sys.dm_exec_sessions as ES on ES.session_id = EC.session_id where EC.session_id = @@SPID
? - HABO