From: paross1 on
FYI, just a note of caution. When using the solution that I posted, if your
query returns more than one row, and you use CFSET after your CFQUERY to set
the pseudo column with a value, only [b]one row[/b] will have a value set and
the remaining rows will still be NULL.

If you do something like this instead, and set the column to a value using a
[i]constant[/i] within the query:

cfquery datasource="mydb" name="note_this_name" >
select columnone, columntwo,
'i_will_never_be_able_to_use_this_variable' AS not_a_column_name
from tbl_mytable
</cfquery>

then every row returned would contain the value of
'i_will_never_be_able_to_use_this_variable' in the not_a_column_name column.

Phil

From: -==cfSearching==- on
happysailingdude wrote:
[i]
<cfset note_this_name.not_a_column_name =
"i_will_never_be_able_to_use_this_variable" >
...
and i get this error " Element not_a_column_name is undefined in
note_this_name"
How on earth can this be? am i going mad?[/i]

Though this was mentioned already, I think it is worth clarifying. You
[i]cannot[/i] implicitly add a column to a query that way. A query is not the
same type of object as a CF structure. So AFAIK you cannot apply that
particular technique to queries. To add a column your must use one of the
options Ian and Phil mentioned.