locked
Passing Parameters to a procedure RRS feed

  • Question

  •  

    How does we pass dynamic number of parameters to a procedure?

    Eg.

     

    DECALRE @IDs varchar(50);

     

    SET @IDs = '1,2,3'

     

    SELECT Description FROM MyTable WHERE ID IN (@IDs )

     

    Here ID is int. When I tested this, it shows an error 'Cannot covert '1,2,3' to int'. No errors while it is one number ie '1'

     

    How I can manage this type of problem in a stored procedrue that receive the @IDs as parameters?

    Friday, May 30, 2008 5:52 AM