View Plan Guide Properties
You can view the properties of plan guides in SQL Server 2012 by using SQL Server Management Studio or Transact-SQL
In This Topic
-
Before you begin:
-
To view the properties of plan guides, using:
To view the properties of a plan guide
-
Click the plus sign to expand the database in which you want to view the properties of a plan guide, and then click the plus sign to expand the Programmability folder.
-
Click the plus sign to expand the Plan Guides folder.
-
Right-click the plan guide of which you want to view the properties and select Properties.
The following properties show in the Plan Guide Properties dialog box.
-
Click OK.
To view the properties of a plan guide
-
In Object Explorer, connect to an instance of Database Engine.
-
On the Standard bar, click New Query.
-
Copy and paste the following example into the query window and click Execute.
-- If a plan guide named “Guide1” already exists in the AdventureWorks2012 database, delete it. USE AdventureWorks2012; GO IF OBJECT_ID(N'Guide1') IS NOT NULL EXEC sp_control_plan_guide N'DROP', N'Guide1'; GO -- creates a plan guide named Guide1 based on a SQL statement EXEC sp_create_plan_guide @name = N'Guide1', @stmt = N'SELECT TOP 1 * FROM Sales.SalesOrderHeader ORDER BY OrderDate DESC', @type = N'SQL', @module_or_batch = NULL, @params = NULL, @hints = N'OPTION (MAXDOP 1)'; GO -- Gets the name, created date, and all other relevant property information on the plan guide created above. SELECT name AS plan_guide_name, create_date, query_text, scope_type_desc, OBJECT_NAME(scope_object_id) AS scope_object_name, scope_batch, parameters, hints, is_disabled FROM sys.plan_guides WHERE name = N’Guide1’; GO
For more information, see sys.plan_guides (Transact-SQL).
