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:137494
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

This list and all House of Fusion resources hosted by CFHosting.com. The place for 
dependable ColdFusion Hosting.
http://www.cfhosting.com

Reply via email to