Just do this:

SELECT *
FROM table
WHERE ID IN ( <cfqueryparam cfsqltype="CF_SQL_INTEGER" value="#myVariable#" 
list="true" /> )

----------------------------------------

From: "Paul Alkema" <[email protected]>
Sent: Tuesday, April 20, 2010 1:56 PM
To: "cf-talk" <[email protected]>
Subject: MSSQL "Where In" not working with variables

I know this is a CF list, sorry for posting this in the wrong area, but I
thought maybe one intelligent people might know. I've been working with 
the
"WHERE IN" clause in MSQL and It seems not to be working well for me with 
a
variable for some reason..

This is an example of what I'm trying to do

DECLARE @idList varchar(max)

SET @idList = '1,2'

SELECT *

FROM table

WHERE ID IN (@idList)

Any ideas?

Thanks,

Paul



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:333043
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

Reply via email to