Below, I have an alternative script to get the cached plan. SELECT (SELECT TOP 1 SUBSTRING(sql_text.text,statement_start_offset / 2+1 , ((CASE WHEN statement_end_offset = -1 THEN (LEN(CONVERT(nvarchar(max),sql_text.text)) * 2) ELSE statement_end_offset END ...
↧