Click here to Skip to main content
15,905,679 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
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
Posted

it is a system function called fn_get_sql. See here[^].
More in depth here[^]
 
Share this answer
 
v2
Try this Query

SQL
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


Thanks
--RA
 
Share this answer
 
Comments
gopalgupta 2-Feb-12 5:24am    
this does not return the parameter values that were passed while executing the sp .... it just returns the create sp statement
Rajesh Anuhya 2-Feb-12 5:28am    
Have you tried this ???
gopalgupta 2-Feb-12 6:06am    
yes ... i already had tried the same query

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900