Is it possible to capture the text of an RPC SELECT statement from within the view which it calls? I have tried using [i]dm_exec_cached_plans[/i], [i]dm_exec_query_stats[/i] and [i]dm_exec_sql_text[/i] but query plans don't seem to be cached until after they are executed. Even [i]dm_exec_query_memory_grants[/i] is unavailable until processing is completed.I need to somehow get the entire query that is currently being executed. I believe [i]dm_exec_requests[/i] only returns the current statement, not the full request. Is there some way to tap into [i]sp_prepexec[/i]? I am also looking into Extended Events as a possible solution. Is there anything else I can do?This is SQL Server 2014 -- I posted more details at [url=http://stackoverflow.com/questions/36437573/how-to-get-query-plan-during-execution]http://stackoverflow.com/questions/36437573/how-to-get-query-plan-during-execution[/url]Thanks!
↧