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?
Asked
Active
Viewed 427 times
2

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 ` – David Faber Sep 10 '12 at 22:16` block - http://livedocs.adobe.com/coldfusion/8/htmldocs/help.html?content=Tags_p-q_17.html
4 Answers
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
-
2Trick: For those running CF9+, you can also do `
`, which is a tad shorter. – Chris Peters Aug 24 '12 at 12:58
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
-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