Dan Cramer

The occasional thought on the stuff I think about

Displaying the SQL from a Query

Ray Camden has put up a very nice post about pulling the actual text of a ColdFusion query. I’ve been playing around with ColdFusion 8 in my dev environment and one of the things I miss most when going back to a 7 server is the text of the SQL in the <cfdump> for the query.

Go read the article for a more thorough explanation bust basically there are two ways to see the text of a query.

  1. Add the ‘result=yourstruct’ attribute to your query tag and a bunch of meta data about the query will be put in yourstruct
  2. Call the function getMetaData() on the query and you’ll get a bunch of information about the column names and types of the query

The full article explains a lot more about the two approaches. This is a great tip especially when you don’t have access to a server’s administration application.



Tagged as , + Categorized as ColdFusion, SQL

Leave a Reply