Visit Sponsor

Written by 4:59 pm ColdFusion

Field is a reserved word in cfqueryparam

A workflow application I recently worked on tracks workflow between two groups, a legal group and a group working in the field. I aptly named the groups “legal” and “field”.

This turned out to cause problems when using cfqueryparam.
The column was a varchar column so I would imagine the text ‘FIELD’ would be just another string of text

Instead:

Macromedia][SQLServer JDBC Driver]Unsupported data conversion.

SELECT TOP 1 TimeCardID, ObjectID, UserID,
UserType, DateTimeIn, DateTimeOut, DateCreated FROM
TimeCard WHERE ObjectID = (param 1) AND UserType =
(param 2) ORDER BY DateCreated

(param 1) = [type='IN', class='java.lang.String',
value='72FAE9F0-16D4-3001-353F84B2E749664D', sqltype='cf_sql_varchar']
, (param 2) = [type='IN', class='java.lang.String', value='FIELD',
sqltype='cf_sql_varchar']

I had no problem using the value ‘FIELD’ in the same column without cfqueryparam. It would seem something inside cfqueryparam must gets unhappy with the text string ‘FIELD’

SELECT TOP 1 TimeCardID, ObjectID, UserID,
UserType, DateTimeIn, DateTimeOut, DateCreated FROM
TimeCard WHERE ObjectID = (param 1) AND UserType =
'FIELD' ORDER BY DateCreated

(param 1) = [type='IN', class='java.lang.String',
value='72FAE9F0-16D4-3001-353F84B2E749664D', sqltype='cf_sql_varchar']

Note: The word ‘field’ doesn’t appear in the MSSQL Reserved word list nor in the SQL Reserved words checker by the illustrious Pete Freitag. Thusly, I believe this is specific to cfqueryparam only.

Visited 1,934 times, 1 visit(s) today
[mc4wp_form id="5878"]
Close