Oh yeah....I always seem to forget this one.  Thanks!  My mind is obviously
not up to full speed yet today.

-----Original Message-----
From: Dave Watts [mailto:[EMAIL PROTECTED]
Sent: Monday, July 26, 2004 10:47 AM
To: CF-Talk
Subject: RE: Weird SQL query behavior

> This one has me really confused.  Can anybody tell me why
> this query returns three records
>
> <cfquery name="getOpenItems" datasource="myDS">
> SELECT * FROM CADMODEL WHERE ITEMNAME IN
> ('211D1234','211D4567') </cfquery>
>
> And this query returns an empty recordset?
>
> <cfset itemNames = "211D1234','211D4567"> <cfquery
> name="getOpenItems" datasource="myDS">
> SELECT * FROM CADMODEL WHERE ITEMNAME IN
> ('#itemNames#') </cfquery>
>
> I'm querying an Access database and using CFMX 6.1.

I suspect your single quotes in the itemNames variable are being doubled. CF
does this by default. Check out the PreserveSingleQuotes function to fix
this.

Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/
phone: 202-797-5496
fax: 202-797-5444
  _____
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]

Reply via email to