Thursday, January 10, 2008

Query of Queries - "unsupported type conversion error" in MX 6.1

I just ran into this frustrating bug yesterday. When working with Query of Queries you (<cfquery dtype="query">) you may get the error, "unsupported type conversion error." After doing some research I found out that the reason this occurs is because Coldfusion attempts to automatically determine the data types for columns in QofQ. If it gets it wrong and you try to use the QofQ in such a way that conflicts with the data-type Coldfusion assigned, you will get this error.

To remedy this you must be sure that when you create the QofQ, the data in your columns LOOKS like the data types you think they should be. For example, if you want Coldfusion to assign the varchar datatype to a column, you should initially populate the column with at least one cell that contains a non-numeric character. If a column contains only integers, Coldfusion will assign an "int" data type to it. I don't know the details of how Coldfusion determines a "date" data type for QofQ, but I'm sure you'll figure it out.

I just find it helpful to know that this "bug" exists so that when I get an "unsupported type conversion error" I'll know what is causing it.

0 comments: