Basic HTML version of Foils prepared May 3 1998

Foil 53 Dynamic SQL - I

From Java Blend and Cold Fusion High Level Database Interfaces CPS616 Web Technologies -- Spring 98. by Chao Wei Ou


Dynamic SQL allows you to dynamically determine which parts of a SQL statement are sent to the database. So if a user leaves a search field empty, for example, you could simply omit the part of the WHERE clause that refers to that field. Or, if a user does not specify a sort order, the entire ORDER BY clause could be omitted.
Cold Fusion uses CFIF/CFELSEIF/CFELSE tags to control how the SQL statement is constructed.
  • <CFQUERY NAME="queryname" DATASOURCE="datasourcename">
  • ...Base SQL statement
  • <CFIF value operator value >
  • ...additional SQL
  • </CFIF>
  • </CFQUERY>



© Northeast Parallel Architectures Center, Syracuse University, npac@npac.syr.edu

If you have any comments about this server, send e-mail to webmaster@npac.syr.edu.

Page produced by wwwfoil on Sat Nov 28 1998