如何获取最后几个已执行的存储过程以及参数值 [英] how to get last few executed Stored procedures along with the values of the parameters

查看:75
本文介绍了如何获取最后几个已执行的存储过程以及参数值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

有人知道如何找到最后几个执行的存储过程以及参数值.
就像我们在Sql Profiler中看到的一样,但是由于某些限制,我的机器上没有Sql Profiler.
我在网上看到了很多示例,但是都没有显示带有参数值的SP.

任何帮助将不胜感激.

问候,
Gopal

Hi all,

Does anybody know how can I find the last few executed Stored procedures along with the values of the parameters.
It is just like what we see in the Sql Profiler but I dont have Sql Profiler on my machine due to certain constraints.
I have seen a lot of examples on the net but none shows the SP with its parameter values.

Any help would be much appreciated.

Regards ,
Gopal

推荐答案

这是一个称为fn_get_sql的系统函数.请参见此处 [此处 [
it is a system function called fn_get_sql. See here[^].
More in depth here[^]


尝试此查询

Try this Query

SELECT deqs.last_execution_time AS [Time], dest.text AS [Query]
FROM sys.dm_exec_query_stats AS deqs
CROSS APPLY sys.dm_exec_sql_text(deqs.sql_handle) AS dest
ORDER BY deqs.last_execution_time DESC



谢谢
--RA



Thanks
--RA


这篇关于如何获取最后几个已执行的存储过程以及参数值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆