I think I can get away using just <cfif>

This is what I have.

<cfset test = 'AAA,BBB,CCC,DDD'>

I'm checked to see if ListGetAt(Line,1,'|') matches one of the above in the variables 
test. Is this the correct syntax?

<cfif ListFindNoCase(ListGetAt(Line,1,'|'),test)>
<!--- So if ListGetAt(Line,1,'|') is equal to CCC and is found in variable test. Do 
this...Otherwise...
  Do this
<cfelse>
  Do else
</cfif>




On Thu, 18 Sep 2003 17:03:54 +0100, Jason Lees (National Express) wrote:

> You dont say what DB to use, but with MSSQL I suppose you could have a look
> up of invalid entries in another SQL table so that your  query reads
> 
>                       <cfquery name="update" DATASOURCE="database">
>                               INSERT INTO strfields
>                               (
>                                       var,
>                                       destination
>                               )
>                               VALUES
>                               (
>                                       <cfqueryparam
> value="#ListGetAt(Line,1,'|')#" cfsqltype="CF_SQL_LONGVARCHAR">,
>                                       <cfqueryparam
> value="#ListGetAt(Line,2,'|')#" cfsqltype="CF_SQL_LONGVARCHAR">
>                               )
>                               where   
>                                       <cfqueryparam
> value="#ListGetAt(Line,1,'|')#" cfsqltype="CF_SQL_LONGVARCHAR"> not in
>                                               (select Prohibited from
> ProhibitedTable)
>                       </cfquery>
> 
> Table ProhibitedTable is defined as 
> 
> create table [ProhibitedTable {
>       WordID int not null]
>       Prohibited varchar (25)
> }
> 
> Then if you make WordId a Prinary key, and auto increment this should solve
> the problem.
> 
> It may need some fine tuning but should work. this also save you having to
> hard code each prohibited word, and also will allow in definate expansion,
> 
> 
> 
> Jason Lees
> Development Team Leader
> National Express.
> 
> 
> -----Original Message-----
> From: Bushy [mailto:[EMAIL PROTECTED]
> Sent: 18 September 2003 15:36
> To: CF-Talk
> Subject: re" <cfquery INSERT into SQL database
> 
> 
> Hi,
> 
> Below is my INSERT inside of a loop. Everything is working just fine. I
> would like to know how I can exclude certain "var" in my SQL statement.
> 
> If the "var" is equal to something then don't insert. Like a WHERE?
> 
> 
> WHERE var NEQ 'xxx' OR 'yyy' OR 'zzz'
> 
> How can I add that sort of syntax to my SQL?
> 
> 
> <cfloop list="#ListLoop#" Index="Line" Delimiters="#strCR#">
> 
>                       <cfquery name="update" DATASOURCE="database">
>                               INSERT INTO strfields
>                               (
>                                       var,
>                                       destination
>                               )
>                               VALUES
>                               (
>                                       <cfqueryparam
> value="#ListGetAt(Line,1,'|')#" cfsqltype="CF_SQL_LONGVARCHAR">,
>                                       <cfqueryparam
> value="#ListGetAt(Line,2,'|')#" cfsqltype="CF_SQL_LONGVARCHAR">
>                               )
>                       </cfquery>
> 
> 
> </cfloop>
> 
> 
> 
> 
> 
> 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Message: http://www.houseoffusion.com/lists.cfm?link=i:4:137501
Archives: http://www.houseoffusion.com/lists.cfm?link=t:4
Subscription: http://www.houseoffusion.com/lists.cfm?link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Your ad could be here. Monies from ads go to support these lists and provide more 
resources for the community. 
http://www.fusionauthority.com/ads.cfm

Reply via email to