2

I have a <cfquery> which generates some SQL inside. It's failing, but I have no idea why. I tried wrapping it inside a <cftry> <cfcatch> block, and dumping the result. However, result is undefined. Is there another way to see what the SQL looks like?

PBG
  • 8,944
  • 7
  • 34
  • 48
  • How about providing your query. – Evik James Aug 24 '12 at 00:18
  • I think the easiest way to accomplish this is simply turning debugging on for your IP address. Failing that, you can specify a result attribute in your `` tag and dump that variable in your `` block - http://livedocs.adobe.com/coldfusion/8/htmldocs/help.html?content=Tags_p-q_17.html – David Faber Sep 10 '12 at 22:16

4 Answers4

10

Inside your <cfcatch>, do this:

<cfdump var="#cfcatch#"><cfabort>

This should show you the query that it tried to run.

Chris Peters
  • 17,918
  • 6
  • 49
  • 65
2

If it fails and the error isn't showing SQL, then it may be an issue with the cfqueryparam, maybe a datatype mis-match, can you provide the text of the error? Maybe even the SQL code?

Nicklepedde
  • 566
  • 2
  • 11
0

Replace every < with &lt; and then cfabort

Phillip Senn
  • 46,771
  • 90
  • 257
  • 373
-1

Remove your cfquery and replace with cfoutput. You can remove the cfqueryparam and just output the values. You should produce a SQL statement that will run fine in a query analyzer.

Evik James
  • 10,335
  • 18
  • 71
  • 122