Saving Statistics Profile Data | SQL Server Performance Forums

SQL Server Performance Forum – Threads Archive

Saving Statistics Profile Data

I have a stored procedure which executes a series of queries in a table to time how long it takes each of them to execute, and stores the executrion time in a results table. I also want to store the Total Subtree cost of each query in that table as well. typing
in the beginning of the procedure causes each query to actually return two result sets, one with the actual results of the query, and another result set which contains the statistics profile of the query, including a column called TotalSubtreeCost. Unfortunately, using SELECT * INTO a temporary table only captures the first result set and not the statistics profile one that I need. I cannot use a trace, and the entire programing logic must be in sql server, I cannot jump out to a .NET app or use CLR within the proc. There has to be a way to get Sql Server 2005 to access the data from the statistics profile result set.
unfortunately not
because turning it on, means you cannot do a SQL op i wrote a client program to dump this into a data set,
then turn around and insert it into SQL