your best bet is to create a stored proc, like you said.  you'll have to
create a cursor and insert your records into it.  then you can loop through
checking the conditions you have in your cf code.  obviously you'll have to
use sql cause oracle/sql server doesn't interpret cf code.

----- Original Message -----
From: "Bosky, Dave" <[EMAIL PROTECTED]>
To: "SQL" <[EMAIL PROTECTED]>
Sent: Monday, January 14, 2002 4:58 PM
Subject: Converting query to stored procedure.


> I'm trying to convert this cold fusion query to stored procedure but can't
> get the correct syntax due to the dynamic where clause.
> Any help would be really cool.
> <CFQUERY NAME="qResultsOfS" DATASOURCE="HTCYP" BLOCKFACTOR="100">
>                 SELECT CustomerID,Telephone,AreaCode,BusinessName,Address,
>                                    City,State,ItemCode,Website,Ad
>                 FROM CustomerInformation
>                 WHERE 0=0
>                 <CFIF IsDefined("FORM.COpt") AND FORM.COpt is not "--">
>                                 AND City = '#FORM.COpt#'
>                 </CFIF>
>                 <CFIF IsDefined("FORM.CTB") AND FORM.CTB is not "--">
>                                 AND Classification = '#FORM.CTB#'
>                 </CFIF>
>                 AND #FORM.SOpt# like '%#FORM.SK#%'
>                 ORDER BY Classification, #FORM.SOpt#
> </CFQUERY>
>
> Thanks,
> Dave
>
>
>
> 
______________________________________________________________________
Get the mailserver that powers this list at http://www.coolfusion.com
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to