NO!!!! There is no need to use dynamic SQL...avoid using it at all costs. If you must use it, is sp_executesql to fire it off rather than EXEC.
You can do it all in standard straightforward SQL. ;-) -----Original Message----- From: Raster, Tim [mailto:[EMAIL PROTECTED] Sent: 11 August 2005 15:34 To: SQL Subject: RE: Using IN clause with a stored procedure You probably need to change it to varchar(?), then you can create an sql string. (watch out for sql injection!) Declare @SQL varchar(8000) Set @SQL = ' SELECT * FROM Content C INNER JOIN Links L ON C.ContentID = L.ContentID WHERE (C.ContentType IN (' + @contenttype + ')) ' Execute (@SQL) -----Original Message----- From: Michael Dinowitz [mailto:[EMAIL PROTECTED] Sent: Wednesday, August 10, 2005 18:55 To: SQL Subject: Using IN clause with a stored procedure I have a stored procedure that will have an In clause. How do I pass a list of integers to it? CREATE PROCEDURE GetNewsContent @contenttype int AS SELECT * FROM Content C INNER JOIN Links L ON C.ContentID = L.ContentID WHERE (C.ContentType IN (@contenttype)) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| 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:6:2345 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/6 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:6 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.6 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54
