4

I am running the following standard query to retrieve the XML execution plan for queries that I ran on my SQL Server via command line.

SELECT pl.query_plan FROM sys.dm_exec_cached_plans ep CROSS APPLY sys.dm_exec_query_plan(ep.plan_handle) pl;

However, it seems that for all the query plans, they are cut off partially. It's as if each row of the result is displaying only a certain number of characters. Is there some setting I need to enable to be able to see the full XML in each row?

1
  • Telling us exactly how many characters are output, e.g., 1023, 32767, 1048575, or something else, might give us a clue as to where it is going wrong. Commented Jun 10, 2022 at 18:04

1 Answer 1

4

If you are using SSMS, it limits the Grid result set size for both XML and non-XML. You can change the setting here.

SSMS Settings

2
  • Unfortunately, I am using the command line and want to get all of these XMLs out for further data analysis.
    – karmanaut
    Commented Jun 10, 2022 at 14:02
  • 1
    If by command line you mean SQLCMD then you might be interested in this stackoverflow.com/a/37548315/4609186
    – Zikato
    Commented Jun 10, 2022 at 15:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.