and here the usage:
Main Topics
Browse All TopicsI want to pass a List<string> variable from my c# code to a stored procedure.
Any ideas on how to do that?
Thank you very much.
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
>Can I use nvarchar in the script instead of varchar ?
yes
>angellll : which rows should we change if we are using sql server 2005 ?
you do not necessarily need to change anything, but you can, if the list will be longer than 8000 characters (including the commas).
if that is so, you change
varchar(8000)
into
varchar(max)
and you could change the substring argument from 8000 to a value that is higher than any item value itself, which is unlikely needed, though
Ok I've created a stored procedure named 'test_procedure' that accepts a @ssn_list parameter.
Now I have a private method in my code.
Tell me if I pass the list correctly.
private void myMethod(List<string> listParameter)
{
SqlCommand command = new SqlCommand("dbo.test_proce
command.CommandType = CommandType.StoredProcedur
command.Parameters.Add(lis
}
Thank you for your help!
I am ok now with the code.
One last tip if you have the time :
How to use your function to create a stored procedure that returns a table using this function that I have created :
ex : SELECT *
FROM dbo.RowSumBasedOnCode('61.
RowSumBasedOnCode function accepts one parameter so I must loop in the parameter list that I get with your function.
Here is the procedure I wrote :
CREATE PROCEDURE dbo.test_procedure
@ssn_list VARCHAR(2000)
AS
SELECT *
FROM dbo.RowSumBasedOnCode(@ssn
The problem here is that RowSumBasedOnCode accepts only one parameter and I want to use your dbo.ParmsToList function in a way that I will loop through the list so that I can use the function inside the loop.(Maybe with a while command ?)
Business Accounts
Answer for Membership
by: angelIIIPosted on 2009-09-15 at 06:32:39ID: 25334667
can you already see this article: http://www.experts-exchang e.com/arti cles/Datab ase/ Miscel laneous/de limited-li st-as-para meter-what -are-the- o ptions.htm l
if not, here just the code you need: 1 function that parses a list into a set:
Select allOpen in new window