Quantcast
Channel: SQLServerCentral » SQL Server 2014 » Administration - SQL Server 2014 » Latest topics
Viewing all articles
Browse latest Browse all 6525

Execution Plan Drilldown Issue

$
0
0
I am trying to list the execution plan in xml (SET SHOWPLAN ON) of a given sp in a query that returns other things as well. To do that I have been trying to use sp_helptext to return the contents of the given sp in a query but I then want the execution plan of that query itself. Basically I am trying to view all SPs that hit a given index and then list the execution plan for the sp that caused the most load on the server and I am trying to do all of this in one query. I have had some luck pulling the indexes of all the tables out and wrapping that up into an sp itself but I am having trouble pulling out the sp that hits an index the most and showing the execution plan for that sp. Can anyone help me out? Here is what I have so far but I cannot get the second select statement inside of the SP to return anything no matter what I do. I have very little experience with XML and I know that the issue is in the last CROSS APPLY but I cannot for the life of me figure out what it is:

Viewing all articles
Browse latest Browse all 6525

Trending Articles