title: How can I get the SQL from a query object in ColdFusion?
body: <p>How can I get the SQL used to generate a cfquery object?  If I cfdump the object, it shows it having an "SQL" property, which contains the actual query.  Turning on debugging won't help me because I am making an API call, so output is not HTML and debug info would break it. I'm just trying to debug exactly what query is being executed.</p>
  
  <pre><code>&lt;cfquery name="tableElements" datasource="TestSQLServer"&gt;
  SELECT * FROM tableElements
  &lt;/cfquery&gt;
  
  &lt;cfdump var="#tableElements#" /&gt; &lt;!--- Shows object having "SQL" property ---&gt;
  &lt;cfoutput&gt;SQL: #tableElements.SQL#&lt;/cfoutput&gt; &lt;!--- Error: Element SQL is undefined in TABLEELEMENTS. ---&gt;
  </code></pre>