I am trying to build a cfquery using a dynamic column name:
<cfquery dbtype="query" name="getColLength">
SELECT MAX(LEN( #ListGetAt(ColumnList, index)# ))
FROM query
</cfquery>
However, this gives me the following error:
Encountered "MAX ( LEN (. Incorrect Select List,
Why doesn't this work? I tried surrounding the #ListGetAt(InputColumnList, 1)#
with a <cfoutput>
tag, but that didn't help. Any ideas?
Update:
This doesn't seem to be a problem with the dynamic column name. If I try hardcoding the column, I get the same error:
SELECT MAX(LEN(MyColumnName))
FROM query
What's wrong with this syntax?
Further Update:
This works:
SELECT Max(MyColumnName)
FROM query
While this doesn't:
SELECT LEN(MyColumnName)
FROM query
The SELECT LEN gives me this error:
Encountered "(. Incorrect Select Statement, Expecting a 'FROM', but encountered '(' instead, A select statement should have a 'FROM' construct.
I suppose I can use the SELECT MAX query and then use the coldfusion len function... but why doesn't this work?