Try using the PreserveSingleQuotes() function in your Where clause. Ie:
Select ItemId, Description from Items
Where ItemName In (#PreserveSingleQuotes(itemnames)#)
This will (theoretically) properly escape the single quotes in your list,
when passed to the database engine.
Dave
----- Original Message -----
From: "Perez, Bismark" <[EMAIL PROTECTED]>
To: "CF-Talk" <[EMAIL PROTECTED]>
Sent: Wednesday, December 20, 2000 09:54
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