The second one translates to:

<cfset itemNames = "211D1234','211D4567">
<cfquery name="getOpenItems" datasource="myDS">
SELECT * FROM CADMODEL WHERE ITEMNAME IN (''211D1234','211D4567'')
</cfquery>

Note the extra outer single quotes ;-)

Cheers

Bryan Stevenson B.Comm.
VP & Director of E-Commerce Development
Electric Edge Systems Group Inc.
t. 250.920.8830
e. [EMAIL PROTECTED]

  ----- Original Message -----
  From: [EMAIL PROTECTED]
  To: CF-Talk
  Sent: Monday, July 26, 2004 9:29 AM
  Subject: 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.

  Nancy P. Tracy
  Electrical Design and Web Development
  GE Global Controls Services
  3800 N. Wilson Ave.
  Loveland, CO 80538
  970.461.5273
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]

Reply via email to