SELECT sqltext.TEXT FROM sys.dm_exec_query_stats AS CP
CROSS APPLY sys.dm_exec_sql_text(sql_handle) AS sqltext
I ran the said sql statement and get some sql scripts and the following is one of them
(@P1 nvarchar(10), @P2 nvarchar(20)) select * from purchline where purchid = @p1 and vendorcode= @p2
I tried to join with dm_exec_query_plan to get the values for @p1 and @p2 but I didn't the actual value of @p1 and @p2 from Query_plan cache, could you please tell me how to get the value of @p1 and @p2? many thanks!