So, I ran into an interesting bug yesterday. Consider the following query:

<cfquery name="qObjectGet"

   SELECT    *
   FROM    #attributes.type#
   WHERE   id =<cfqueryparam
cfsqltype="CF_SQL_INTEGER" value="" list="No" null="No">


This was running fine, but all of a sudden began throwing the following error:

[Macromedia][SQLServer JDBC Driver]Value can not be converted to requested type.

I did a quick google search, but couldn't find anything clearly related - except for one post that suggested simply modifying the query by adding a semicolon. I did and the error went away.

It turns out that this error would return everytime I modified the table. I either had to modify the query or restart CF.

Apparently there is some caching involved of the table schema when using queryparam, and the change to the table schema confused CF.

However, it is not reproduceable. I tried to reproduce it again this morning and was not able to. My coworkers at Mindseye have also seen this and have not been able to reproduce it at will.

So - something to watch out for!