>I have a question.  I have a query that is built depending on many things, 
>the where statement, order by, actual columns asked for that kinda 
>thing.....  I want to save what the actual sql text is that ran that query. 
>  Like what you can see in the debugging code.  Does this make sense?  Any 
>help would be great.
>

I'm assuming that you don't have access to the debugging information and 
that's why you need this.

Off the top of my head, I would use <cffile> to write a text file to the 
file server containing the query. To get the actual query run, I would copy 
and paste the query into the "output" attribute of the <cffile> tag, 
replacing any <cfqueryparam> tags with just the CF variables (as keeping 
<cfqueryparam> will throw an error if not used within <cfquery> tags). So, 
for example:

<cfquery...>
SELECT myColumn
FROM myTable
WHERE id = <cfqueryparam value="#form.myID#" cfsqltype="CF_SQL_NUMERIC">
</cfquery>

<cffile action="WRITE" file="myQuery.txt" output="SELECT myColumn FROM 
myTable WHERE id = #form.myID#" addnewline="Yes">

I haven't tested that, but I don't see why that wouldn't work.

Regards,
Dave.


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
This list and all House of Fusion resources hosted by CFHosting.com. The place for 
dependable ColdFusion Hosting.

                                Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
                                

Reply via email to