Skip to content

sp_BlitzWho fails due to XML exceeding 132 levels #4054

Description

@mnorkett

Version of the script
I don't see a version but it's from a download I did 7/16/2026

What is the current behavior?
When getting XML for query plan and live query plan, the stored procedure throws an error message if the XML levels exceed 132

If the current behavior is a bug, please provide the steps to reproduce.

What is the expected behavior?

Which versions of SQL Server and which OS are affected by this issue? Did this work in previous versions of our procedures?

This is running on SQL Server 2022 latest patch Windows Database Server latest patch

Line 664

Replace existing code with:

		       TRY_CONVERT(XML, derp.query_plan) AS query_plan,
				TRY_CONVERT
						(
							XML,
							COALESCE
						(
							CONVERT(NVARCHAR(MAX), qs_live.Query_Plan),
								' + CASE
								WHEN @GetLiveQueryPlan = 1
								THEN '''<?No live query plan available for this query in sys.dm_exec_query_statistics_xml.?>'''
									ELSE '''<?Live Query Plans were not retrieved. Set @GetLiveQueryPlan=1 to try and retrieve Live Query Plans ?>'''
							END + '

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions