title: How to obtain SQL Server query text?
body: <p>I have Hibernate running queries.</p>
  
  <p>I'm lazy and want to see the SQL it generates, steal it, and use it later (instead of writing it myself).</p>
  
  <p>There are multiple queries being run.</p>
  
  <p>I know I can do something like </p>
  
  <pre><code>INSERT INTO my_sql_text_table
  SELECT sqltext.TEXT,
      req.session_id,
      req.status,
      req.command,
      req.cpu_time,
      req.total_elapsed_time
  FROM sys.dm_exec_requests req
  CROSS APPLY sys.dm_exec_sql_text(sql_handle) AS sqltext
  </code></pre>
  
  <p>to get the currently running SQL.</p>
  
  <p>What's the easiest way to grab all running SQL for a short period of time so I can replay it?
  Limiting to a table or a few tables is OK, so I'm cool with a trigger or something that can do it.</p>