queryAddColumn

Adds a column to a query and populates its rows with the
contents of a one-dimensional array. Pads query columns,
if necessary, to ensure that all columns have the same number
of rows.

queryAddColumn(query, column_name [, datatype], array_name) → returns Numeric

Argument Reference for the queryAddColumn function

query

Required: Yes

column_name

Required: Yes

datatype

Required: No
Column data type. Values:
  • Integer
  • Bigint
  • Double
  • Decimal
  • Varchar
  • Binary
  • Bit
  • Time
  • Date

array_name

Required: Yes

Examples sample code invoking the queryAddColumn function


Tag Example

<!--- Make a query. ---> 
 <cfset myQuery = queryNew("")> 
  <!--- Create an array. ---> 
 <cfset FastFoodArray = arrayNew(1)> 
 <cfset FastFoodArray[1] = "French Fries"> 
 <cfset FastFoodArray[2] = "Hot Dogs"> 
 <cfset FastFoodArray[3] = "Fried Clams"> 
 <cfset FastFoodArray[4] = "Thick Shakes"> 
 <!--- Use the array to add a column to the query. ---> 
 <cfset nColumnNumber = queryAddColumn(myQuery, "FastFood", "VarChar", FastFoodArray)> 
 <cfdump var="#myQuery#" /> 

Fork me on GitHub