kalpesh Bhadani

kalpesh Bhadani

  • NA
  • 12
  • 15.8k

how to pass comma seperated string as single parameter in a SELECT IN in stored procedure

Apr 8 2010 2:27 PM
Hello Everybody..

my question is like this. I have one String str which contains multiple customer Id like C00001,C00002,C00003.. seperated by comma.
Now i wants to pass this string str as single parameter to my stored procedure. I tried below code but it doen't works.
can anybody please help me???????

eg
 foreach (string s in idlist)
        {
            str = str +"'"+ s +"'" + ",";
        }
        str = str.Substring(0, str.Length - 1);

Now i wants to pass this str to my stored procedure as parameter

stored procedure is like this
select * from Customer_Master where CustomerId IN(@CustomerId)



Answers (2)