User Guide
Chapter 2: ColdFusion Functions 481
QueryAddColumn
Adds a new column to a specified query and populates the column’s rows with the
contents of a one-dimensional array. Returns the query object with the additional
column. Padding is added, if necessary, on the query columns to ensure that all
columns have the same number of rows.
See also CFQUERY, QueryNew, QueryAddRow and QuerySetCell.
Syntax QueryAddColumn(
query
,
column-name
,
array-name
)
query
Name of a query that was created with QueryNew.
column-name
The name of the new column.
array-name
The name of the array whose elements are to populate the new column.
Usage You can add columns to any type of query object, such as queries retrieved with
CFQUERY or queries created with QueryNew. The only type of query that you cannot
use QueryAddColumn on is a cached query.
This function is particularly useful if you are an Oracle developer and would like to
generate a query object from the arrays of output parameters which Oracle stored
procedures can generate. Padding is added, if necessary, on the query columns to
ensure that all columns have the same number of rows.
Example <!--- This example shows the use of QueryAddColumn --->
<HTML>
<HEAD>
<TITLE>
QueryAddColumn Example
</TITLE>
</HEAD>
<basefont face="Arial, Helvetica" size=2>
<body bgcolor="#FFFFD5">
<BODY>
<H3>QueryAddColumn Example</H3>
<P>This example adds three columns to a query object and then populates
the columns with the contents of three arrays.</P>