[thelist] [CF & SQL] Passing ColdFusion List Variable into SQL IN Statement

Minh Lee Goon evolt at goonies.info
Thu Jul 6 11:18:25 CDT 2006


Greetings all,

I'm working with a ColdFusion list, and would like to select records 
from my database table matching elements in this list. Here's what my 
SQL statement looks like:

SELECT *
FROM TableName
WHERE ColumnName IN ('#ListName#')

I've always had good luck with statements like this, so I'm baffled now. 
I did try to hard-code the list elements into the query statement and 
that worked just fine. Do I have to replace the list elements to add the 
single quotes around them?

Thanks.

Minh Lee Goon




More information about the thelist mailing list