Try putting a preserveSingleQuotes in the query.
<cfquery name="getAllDWGs" datasource="DSN" dbtype="ODBC">
Select *
From blah
where DWGRID IN (#preserveSingleQuotes(myDWGlist)#)
Order by DWGDNO
</cfquery>
-----Original Message-----
From: Ron Mast [mailto:[EMAIL PROTECTED]
Sent: Friday, September 29, 2006 12:39 PM
To: Dallas/Fort Worth ColdFusion User Group Mailing List
Subject: [DFW CFUG] SQL IN statement help
Hi All,
I have converted an array to a list and it looks like this:
<cfset allCusArray = arrayNew(1)>
<cfloop query="getAllCus">
<cfset allCusArray[currentRow] = "'"&trim(CDGDID)&"'">
</cfloop>
<cfset myDWGlist = ArrayToList(allCusArray, ",")>
Now I want to use that list in the query as the value of the IN
statement:
<cfquery name="getAllDWGs" datasource="DSN" dbtype="ODBC">
Select *
From blah
where DWGRID IN (#myDWGlist#)
Order by DWGDNO
</cfquery>
I'm getting the following error:
[Macromedia][SequeLink JDBC Driver][ODBC Socket][IBM][iSeries Access
ODBC Driver][DB2 UDB]SQL0104 - Token CBE99B83 was not valid. Valid
tokens: ,.
The error occurred in
E:\wwwroot\data\appDWGDisplay_cusSearchForDWGs.cfm: line 29
27 : Select *
28 : From AEQDWG
29 : where DWGRID IN (#myDWGlist#)
30 : Order by DWGDNO
31 : </cfquery>
SQL Select * From AEQDWG where DWGRID IN
(''CBE99B83-E8BB-07D5-ECC57AAA3A6D0F11'',''CBE99BB2-B847-C9BD-D112B583AE
B4FF20'') Order by DWGDNO
DATASOURCE blah
VENDORERRORCODE -104
SQLSTATE 42000
What's going on causing the rearrangement of single quotes? How do I fix
this issue? Sorry if this is a dumb question. Thanks in advance.
Ron Mast
Truth Hardware
Webmaster
507-444-4748
_______________________
This e-mail and any files transmitted with it are confidential and are
intended solely for the use of the individual to whom they are
addressed. If you are not the intended recipient or the individual
responsible for delivering the e-mail to the intended recipient, please
be advised that you have received this e-mail in error and that any use,
dissemination, forwarding, printing, or copying of this e-mail is
strictly prohibited.
_______________________________________________
Reply to DFWCFUG:
[email protected]
Subscribe/Unsubscribe:
http://lists1.safesecureweb.com/mailman/listinfo/list
List Archives:
http://www.mail-archive.com/list%40list.dfwcfug.org/
http://www.mail-archive.com/list%40dfwcfug.org/
DFWCFUG Sponsors:
www.HostMySite.com
www.teksystems.com/
CONFIDENTIALITY NOTICE: The information contained in this e-mail and attached
document(s) may contain confidential information that is intended only for the
addressee(s). If you are not the intended recipient, you are hereby advised
that any disclosure, copying, distribution or the taking of any action in
reliance upon the information is prohibited. If you have received this e-mail
in error, please immediately notify the sender and delete it from your system.
_______________________________________________
Reply to DFWCFUG:
[email protected]
Subscribe/Unsubscribe:
http://lists1.safesecureweb.com/mailman/listinfo/list
List Archives:
http://www.mail-archive.com/list%40list.dfwcfug.org/
http://www.mail-archive.com/list%40dfwcfug.org/
DFWCFUG Sponsors:
www.HostMySite.com
www.teksystems.com/