Quantcast
Channel: SQL Server Integration Services forum
Viewing all articles
Browse latest Browse all 24688

Getting an execution plan as XML from an Execute SQL Task.

$
0
0

Hi all, 

I am wondering if it is possible to get the execution plan of a query by using a SQL Script Task.  I am have code similar to this running in the task:

SET SHOWPLAN_XML ON;
GO
SELECT 1 AS ABC
GO
SET SHOWPLAN_XML OFF;

I then need to find some way to get the result set.  Because there is only one result set actually returned, I figured I could just do single row but that does not work.  

Error: No result rowset is associated with the execution of this query.

So I throught maybe I need to go with full resulset.  

[Execute SQL Task] Error: Executing the query "SET SHOWPLAN_XML ON;" failed with the following error: "No disconnected record set is available for the specified SQL statement.". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.

Am I going to have to go Scripttask to work this out.  SHOWPLAN has some stringent batch requirements that must be adhered to.


Viewing all articles
Browse latest Browse all 24688

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>