Using the SET SHOWPLAN Options

In addition to the graphical execution plans available in SSMS, SQL Server 2008 provides three SET SHOWPLAN options to display the execution plan information in a text or XML format. These options are SET SHOWPLAN_TEXT, SET SHOWPLAN_ALL, and SET SHOWPLAN_XML. When one of these options is enabled, SQL Server returns the execution plan generated for the query, but no results are returned because the query is not executed. It’s similar to the Display Estimated Execution Plan option in SSMS.

You can turn on the textual execution plan output in a couple of ways. One way is to issue the SET SHOWPLAN_TEXT ON, SET SHOWPLAN_ALL ON, or SET SHOWPLAN_XML ON command directly in the SSMS query window. These commands must be ...

Get Microsoft® SQL Server 2008 R2 Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.