<cfquery name = "query_name"          dataSource = "ds_name"          username = "username"          password = "password"          maxRows = "number"          blockFactor = "blocksize"          timeout = "seconds"          cachedAfter = "date"          cachedWithin = "timespan"          debug = "Yes" or "No"  or debug>  SQL statement(s)  </cfquery> 


Use this tag to write structured query language (SQL) queries that are passed on to your database through the datasource name. SQL statements within this tag are executed just as they are written and can be used to select, insert, update, or delete data.


name (Required)

Name of the query. This query name will be referenced throughout the application to utilize the data.

dataSource (Required)

Name of datasource from which the query retrieves data.

username (Optional)

Overrides username specified in the ColdFusion Administrator for the datasource.

password (Optional)

Overrides password specified in the ColdFusion Administrator for the datasource.

maxRows (Optional)

Default: -1 (All). Maximum number of rows to return in the recordset.

blockFactor (Optional)

Default: 1. Maximum rows to get at one time from the server. The range is from 1 100. This can be used to make the query more efficient.


Maximum number of seconds that each action of a query is permitted to execute before returning an error.

cachedAfter (Optional)

If query caching is enabled, then ColdFusion retrieves the data from the cache if the current date is after the specified date. Year values in the range 0-29 are interpreted as 2000-2029; in the range 30-99, they are interpreted as 1930-1999. Values in the range 100 9999 are interpreted as absolute A.D. dates.

cachedWithin (Optional)

Time span, using the CreateTimeSpan function. If original query date falls within the time span, the cached query data is used. CreateTimeSpan defines a period from the present back. Takes effect only if query caching is enabled in the Administrator. To use cached data, the current query must use the same SQL statement, datasource, query name, username, password, and dbType.

debug (Optional); value and equals sign may be omitted

  • Yes. or if value is omitted. If debugging is enabled, but the Administrator Database Activity option is not enabled, displays SQL submitted to datasource and number of records returned by query.

  • No. If the Administrator Database Activity option is enabled, suppresses display.

Inside ColdFusion MX
Inside Coldfusion MX
ISBN: 0735713049
EAN: 2147483647
Year: 2005
Pages: 579 © 2008-2017.
If you may any questions please contact us: