Within SQL 2022, and when experiencing any sort of PAGE waits, the resource_description value within sys.dm_os_waiting_tasks contains additional information that was not returned in previous versions of SQL Server and was causing the CASE statement for PAGE waits to error out with an invalid data type conversion. The updated code will correctly parse the resource_description value to return the 'blocked_pageid' value in SQL Server 2022 and previous versions.
Within SQL 2022, and when experiencing any sort of PAGE waits, the resource_description value within sys.dm_os_waiting_tasks contains additional information that was not returned in previous versions of SQL Server and was causing the CASE statement for PAGE waits to error out with an invalid data type conversion. The updated code will correctly parse the resource_description value to return the 'blocked_pageid' value in SQL Server 2022 and previous versions.