sp_query_store_clear_hints (Transact-SQL)
Applies to:
SQL Server 2022 (16.x)
Azure SQL Database
Azure SQL Managed Instance
Removes all Query Store hints for a given query_id.
Transact-SQL syntax conventions
Syntax
sp_query_store_clear_hints
@query_id bigint;
Return Values
0 (success) or 1 (failure)
Remarks
Query Store hints are created by sys.sp_query_store_set_hints (Transact-SQL).
Permissions
Requires the ALTER permission on the database.
Examples
Clear query hint text
The following example removes the query store hint text:
EXEC sys.sp_query_store_clear_hints @query_id = 39;
View Query Store hints
The following example returns existing Query Store hints:
SELECT query_hint_id, query_id, query_hint_text, last_query_hint_failure_reason, last_query_hint_failure_reason_desc, query_hint_failure_count, source, source_desc
FROM sys.query_store_query_hints
WHERE query_id = 39;