sp_query_store_remove_plan (Transact-SQL)

適用於: SQL Server 2016 (13.x) 和更新版本 Azure SQL DatabaseAzure SQL 受控執行個體

從 查詢存放區 移除單一方案。

Transact-SQL 語法慣例

語法

sp_query_store_remove_plan [ @plan_id = ] plan_id
[ ; ]

引數

[ @plan_id = ] plan_id

要移除之查詢計劃的標識碼。 @plan_id是 bigint,沒有預設值。

傳回碼值

0 (成功)或 1 (失敗)。

權限

需要資料庫的 ALTER 許可權。

範例

下列範例會傳回 查詢存放區 中查詢的相關信息。

SELECT txt.query_text_id,
    txt.query_sql_text,
    pl.plan_id,
    qry.*
FROM sys.query_store_plan AS pl
INNER JOIN sys.query_store_query AS qry
    ON pl.query_id = qry.query_id
INNER JOIN sys.query_store_query_text AS txt
    ON qry.query_text_id = txt.query_text_id;

識別 您想要刪除的 plan_id之後,請使用下列範例來刪除查詢計劃。

EXEC sp_query_store_remove_plan 3;