QueryNew |
Description
Creates an empty query (query object).
Returns
An empty query with a set of named columns, or an empty query.
Category
Query functions
Function syntax

    QueryNew(columnlist)

See also
QueryAddColumn, QueryAddRow, QuerySetCell
Parameters

Parameter | Description
columnlist | A string or a variable that contains one. Delimited list of column names, or an empty
| string.

Usage
If you specify an empty string, you can add a column to the query and populate its rows with the contents of a one-dimensional array using QueryAddColumn.

Example

    <h3>QueryNew Example</h3>
    <p>We will construct a new query with two rows:
    <cfset myQuery = QueryNew("name, address, phone")>
    <!--- make some rows in the query --->
    <cfset newRow = QueryAddRow(MyQuery, 2)>
    <!--- set the cells in the query --->
    <cfset temp = QuerySetCell(myQuery, "name", "Fred", 1)>
    <cfset temp = QuerySetCell(myQuery, "address", "9 Any Lane", 1)>
    <cfset temp = QuerySetCell(myQuery, "phone", "555-1212", 1)>
    <cfset temp = QuerySetCell(myQuery, "name", "Jane", 2)>
    <cfset temp = QuerySetCell(myQuery, "address", "14 My Street", 2)>
    <cfset temp = QuerySetCell(myQuery, "phone", "555-1444", 2)>
    <!--- output the query --->
    <cfoutput query = "myQuery">
    <pre>#name#   #address#   #phone#</pre>
    </cfoutput>
    To get any element in the query, we can output it individually
    <cfoutput>
       <p>#MyQuery.name[2]#'s phone number: #MyQuery.phone[2]#
    </cfoutput>

columnlist |
A string or a variable that contains one. Delimited list of column names, or an empty string.