s = 32,45,2,13,4
in my SQL stored procedure... i want to do something like...
SELECT * FROM t1 WHERE t1.a IN s
I know that will not work with the comma character seperating each value...but is there a way to do it so that it work? i dont think there is...but i just want to make sure.This would work:
|||do you know why it has to be done this way? would it have worked if a delimiter was | rather than ,?
CREATE PROCEDURE GetProductsByID
(
@.s varchar(255)
)AS
DECLARE @.SELECT varchar(500)
SET @.SELECT = 'SELECT * FROM Products WHERE Products.ProductID IN (' + @.s + ')'EXEC(@.SELECT)
and say we have 33,23,45,65
will that also return rows wid ID's of 3, b/c of 33?
No comments:
Post a Comment