PBG
PBG

Reputation: 9644

In ColdFusion 8, is there a way to see the SQL inside a failing cfquery?

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?

Upvotes: 2

Views: 465

Answers (4)

Phillip Senn
Phillip Senn

Reputation: 47595

Replace every < with &lt; and then cfabort

Upvotes: 0

Evik James
Evik James

Reputation: 10473

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.

Upvotes: -1

Chris Peters
Chris Peters

Reputation: 18090

Inside your <cfcatch>, do this:

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

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

Upvotes: 10

Nicklepedde
Nicklepedde

Reputation: 565

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?

Upvotes: 2

Related Questions