Name

CFQUERY

Synopsis

<CFQUERY>
  [<CFQUERYPARAM>]
SQL statements
</CFQUERY>

Performs SQL operations against a data source or existing query object.

Attributes

NAME=" query_name "

Name to assign to the query. Valid query names must begin with a letter and can contain only letters, numbers, and underscore characters. Required when passing an SQL SELECT statement; optional for all other SQL operations. Although the NAME attribute is required only for SQL SELECT statements, you may wish to use it in all your queries. It makes debugging easier, especially for templates that contain multiple queries because it allows you to identify each query by name in the debugging output.

DATASOURCE=" datasource_name "

The name of the data source to connect to when executing the query. Required except when DBTYPE is Query or Dynamic.

DBTYPE=" database_type "

The type of database driver to use. Optional. Possible choices are:

ODBC (the default)

Connect to the data source using an ODBC driver.

OLEDB

Connect using an OLEDB driver.

Oracle73

Connect using the Oracle 7.3 native driver. This requires the 7.3.4.0.0 or later client libraries be installed on the ColdFusion server.

Oracle80

Connect using the Oracle 8 native driver. This requires the 8.0 or later client libraries be installed on the ColdFusion server.

Sybase11

Connect using the Sybase 11 native driver. This requires the 11.1.1 or later client libraries be installed on the ColdFusion server.

DB2

Connect using the DB2 5.2 native driver.

Informix73 ...

Get Programming ColdFusion now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.