QueryExecute( sql=string, params=any, options=struct );

Returns: any

Argument Description
string, required

SQL to execute

any, optional

Array or as a structure of parameter values.

When passing an array use ? as place holders and pass them in the order they are to be used.

When passing a struct use :keyName where keyName is the name of the key in the structure corresponding to the parameter.

The array or structure can be a structure with keys that match the names of the cfqueryparam names: maxlength, list, scale, separator, null, cfsqltype|sqltype|type and value

Alias: param

struct, optional

Struct containing query options, all cfquery tag attributes are supported except the name attribute.

Alias: option, queryOptions


_test = queryNew(
        "_id, _need, _forWorld",
        "integer, varchar, varchar",
        [[01,'plant', 'agri'],[02, 'save','water']]
    queryResult = queryExecute(
        sql = 'SELECT * FROM _test WHERE _need = :need',
        params = {
            need: {
                value: "plant",
                type: "varchar"
        options = {
            dbtype = 'query'

See also