2

I'm working on a scalar function that returns the estimated CPU usage on a SQL query without running it. For this I am using "SHOWPLAN_ALL" with the corresponding query in a Stored Procedure that generated dynamically (varying according to the query sent). The problem that I have is to keep the table showing the "SHOWPLAN_ALL" to use this data and get the value you want. Any idea ? Thank you very much for the space.

  • I severely doubt it's possible to access the result of showplan from within T-SQL. Besides, ["SET SHOWPLAN_TEXT and SET SHOWPLAN_ALL cannot be specified inside a stored procedure; they must be the only statements in a batch."](https://msdn.microsoft.com/en-us/library/ms187735.aspx). – JimmyB Jul 03 '15 at 14:30

0 Answers0