Skip to main content
Known Participant
May 29, 2009
Question

Is there a way to output SQL being sent to database from cfm page?

  • May 29, 2009
  • 5 replies
  • 731 views

I am getting a SQL Error (Incorrect sytax near ','), so I was wondering if there was a way to output the actual sql statement being sent?

    This topic has been closed for replies.

    5 replies

    Ken_F_Author
    Known Participant
    June 2, 2009

    Got it.  I didn't have the 'Enable Robust Exception' box checked in the CF Administrator.  Thanks!

    Ken_F_Author
    Known Participant
    June 2, 2009

    CF debugging is enabled.  I'm talking about when the SQL throws an error, not when it is correct.  When it is correct, yes it just shows up.  But I would like to see the SQL statement that was attempted but failed.  

    Inspiring
    June 2, 2009

    You don't see stuff like this:

    The error occurred in D:\DW\dwtest\Dan\abc.cfm: line 70
    68 : <cf_testdb dsn="copathsq">
    69 : 
    70 : <cfquery name="q1" datasource="copathsq" result="x">
    71 : select 'test'
    72 : from
    

    Inspiring
    June 2, 2009

    Doesn't it just show up?  Or are you not the user?

    Known Participant
    June 2, 2009

    Enable your CF's debug on. This is the best tool for Debuging :-)

    ilssac
    Inspiring
    May 29, 2009

    One easy way is to use the result parameter of the <cfquery...> tag.

    <cfquery name="myQuery" result="stuff">

    ...

    </cfquery>

    <cfdump var="#stuff#">

    OR

    <cfoutput>#stuff.sql#</cfoutput>