Sign in with Microsoft
Sign in or create an account.
Select a different account.
You have multiple accounts
Choose the account you want to sign in with.


Assume that you enable the Query Store feature for a database in an instance of SQL Server 2016. When you query the query plan by using join operations, the query_plan column in the query result contains unusual characters.

For example, you join sys.query_store_plan to another view, as in the following query:

SELECT qt.query_sql_text, q.query_id, qt.query_text_id, p.plan_id, p.query_plan
FROM sys.query_store_query_text AS qt
         INNER JOIN sys.query_store_query AS q ON qt.query_text_id = q.query_text_id
         INNER JOIN sys.query_store_plan AS p ON q.query_id = p.query_id
In this situation, the query_plan column in the query result contains characters such as the following:



The fix for this issue is included in the following cumulative update for SQL Server:

Cumulative Update 2 for SQL Server 2016

Each new cumulative update for SQL Server contains all the hotfixes and all the security fixes that were included with the previous cumulative update. Check out the latest cumulative updates for SQL Server:

Latest cumulative update for SQL Server 2016


To work around this issue, do not join sys.query_store_plan to another view when you try to retrieve query_plan. Instead, to retrieve query_plan for a given plan_id, run a separate query for that plan_id that resembles the following:

select plan_id, query_plan
from sys.query_store_plan
where plan_id = plan_id


Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.


Learn about the terminology Microsoft uses to describe software updates.

Need more help?

Want more options?

Explore subscription benefits, browse training courses, learn how to secure your device, and more.

Communities help you ask and answer questions, give feedback, and hear from experts with rich knowledge.

Was this information helpful?

What affected your experience?

Thank you for your feedback!