title: SQL query result truncated
body: <p>I have the following query to find bad performing queries</p>
  
  <pre><code>SELECT TOP 10
      total_worker_time/execution_count AS Avg_CPU_Time
          ,execution_count
          ,total_elapsed_time/execution_count as AVG_Run_Time
          ,(SELECT
                SUBSTRING(text,statement_start_offset/2,(CASE
                       WHEN statement_end_offset = -1 THEN LEN(CONVERT(nvarchar(max), text)) * 2 
                       ELSE statement_end_offset 
                                 END -statement_start_offset)/2
                         ) FROM sys.dm_exec_sql_text(sql_handle)
           ) AS query_text 
  FROM sys.dm_exec_query_stats 
  
  --pick your criteria
  
  ORDER BY Avg_CPU_Time DESC
  --ORDER BY AVG_Run_Time DESC
  --ORDER BY execution_count DESC 
  </code></pre>
  
  <p>Found here: <a href="https://stackoverflow.com/questions/2499910/how-to-find-the-worst-performing-queries-in-sql-server-2008">How to find the worst performing queries in SQL Server 2008?</a></p>
  
  <p>However, when executed in Management Studio, the query_text is truncated and I cannot see the full query.
  The queries found are very long, is there a way to still see the full query?</p>
  
  <p>Thanks in advance.</p>