Hi,

because your list contains single quotes as item qualifiers, you don't need to put 
them around the whole list again. And you need to use the PreserveSingleQuotes() 
function because CF automatically escapes single quotes in SQL-Statements:

<cfset ItemNames = "'Item1','Item2','Item34'">

<cfquery ....
   SELECT ItemID, Description FROM Items
   WHERE ItemName IN (#PreserveSingleQuotes(ItemNames)#)
</cfquery...

This way it should work..

Regards,

Chris

------Original Message------
From: "Perez, Bismark" <[EMAIL PROTECTED]>
To: CF-Talk <[EMAIL PROTECTED]>
Sent: December 20, 2000 2:54:30 PM GMT
Subject: List field been used as a retrieval argument


Hello list,

I have a problem I can't see to find the answer... I have a list field I
want to use as a retrieval argument of a query, but some how the database
don't like the way I'm defining the retrieval... for the life of me I can't
see where the error is, maybe you guys can help...  the following is an
example of the code

<cfset ItemNames = "'Item1','Item2','Item34'">

<cfquery ....
   SELECT ItemID, Description FROM Items
   WHERE ItemName IN '(#ItemNames#)'
</cfquery...

I have tried to even include the parenthesis in the ItemNames field with not
luck... if I use the statement on an interactive SQL it returns records so I
know the statement works...

Bismarck Perez
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to