Yes, it is one way. You could also pass the values into a temp table and perform a normal select on that temp table with the column (ID) in the where clause.
Either way will work and both ways are good. Though by using the latter would result in (probably) better performance as its no conducting dynamic SQL statements which cannot be precompiled by SQL Server. -----Original Message----- From: John Stanley [mailto:[EMAIL PROTECTED] Sent: 27 January 2005 14:59 To: CF-Community Subject: SQL Brain Fart 100 of your favorite muffins warmed and slathered with Plugra http://www.kellerscreamery.com/products/plugra/index.php to the first correct answer. what's up with this: declare @list varchar(25) set @list = '184203,184204' select * from my_table where id in (@list) say this list is passed into a proc. i cant figuire out the correct syntax to return the data without using the method below. the id column is an int data type. i can do this in dynamic sql like. declare @sql varchar(100), @list varchar(25) set @list = '184203,184204' select @sql = 'select * from my_table where id in (' + @list + ')' exec (@sql) is the dynamic sql the only way to do this? ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Find out how CFTicket can increase your company's customer support efficiency by 100% http://www.houseoffusion.com/banners/view.cfm?bannerid=49 Message: http://www.houseoffusion.com/lists.cfm/link=i:5:144802 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/5 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:5 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.5 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54
