you can not have your cfif conditional execute on the database-side; but you
can put cfif and other cftags inside a cfquery tag-pair. for example if you
had a page that had to display some item from your database, you could use a
cfif to decide whether to pull an item by id or if no id is specified, pull
the default item:
<cfquery name="iteminfo" datasource="mydsn">
SELECT TOP 1 * FROM tbl_Merchandise
WHERE
<cfparam name="currentitem" default="">
<cfif currentitem IS NOT "">
id=#currentitem#
<cfelse>
default='y'
</cfif>
</cfquery>
but it is important to note that the cftags, including the cfif are
processed before the query itself is sent to the sql server, so all this
happens within cf.
> -----Original Message-----
> From: LANCASTER, STEVEN M. (JSC-OL) (BAR)
> [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, March 12, 2002 13:30
> To: CF-Talk
> Subject: SQL in a CFIF
>
>
> How would write a select statement within a CFIF statement.
>
> 1. Can it be done?
>
> 2. What is the Syntax?
>
> Steven Lancaster
> Barrios Technology
> NASA/JSC
> 281-244-2444 (voice)
> [EMAIL PROTECTED]
>
______________________________________________________________________
Why Share?
Dedicated Win 2000 Server � PIII 800 / 256 MB RAM / 40 GB HD / 20 GB MO/XFER
Instant Activation � $99/Month � Free Setup
http://www.pennyhost.com/redirect.cfm?adcode=coldfusionc
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists