SQL statements

Performs SQL operations against a data source or existing query object. In ColdFusion MX, SQL reserved words can no longer be used as column or query names. When building dynamic queries from form or URL parameters, Macromedia recommends always binding the parameters with cfqueryparam tags.


name=" query_name "

Name to assign to the query. Valid query names must begin with a letter, underscore, or Unicode currency symbol ($) and can contain only letters, numbers, underscores, and Unicode currency symbols. 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.

blockfactor=" block_size "

The maximum number of rows to retrieve from the server at a time. Optional. The range is from 1 to 100; 1 is the default. Note that some drivers may reduce the block factor automatically.

cachedafter=" date "

A date for using cached query data. Cached query data is used only if the date of the original query is after the date specified in CACHEDAFTER. To use cached ...

Get Programming ColdFusion MX, 2nd Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.