-2

Possible Duplicate:
SQL query filtering by list of parameters

I have a method ADO.NET that passes an array of strings, a name, and an array of ints to a stored procedure. I can do that one at a time but I want to pass them along all at once .. is it possible?

Using SQL server 2008

Thanks

4
  • 1
    What's RDBMS are you using? I believe only a select few have the concept of arrays. Commented Jul 19, 2012 at 18:04
  • 1
    Possible Duplication Commented Jul 19, 2012 at 18:10
  • Can you show some sample values, indicate how the individual elements in the array are related (e.g. is the first name related to the first int, or are they completely unrelated sets), and what the stored procedure should do with them? Commented Jul 19, 2012 at 18:15
  • Alright, I have to create a stored procedures that inserts data into 2 tables. 1. Fruit and second to FruitType .. Fruit has an ID (auto generated PK), the string ARRAY of information as FuritInfo .. the FruitType has ID which is the same as in fruit as it is PK and FK, and FruitTypeID as FK and PK and Fruit information array.. Hope this helps.. Commented Jul 19, 2012 at 18:20

2 Answers 2

3

Sounds like what you want is a Table Parameter: http://msdn.microsoft.com/en-us/library/bb510489.aspx

Basically, you can construct a C# DataTable, and populate all the values in it, and then provide the table as a parameter to a SQL Stored procedure.

Unfortunately, without a bit more information, I can't propose sample code for you.

Sign up to request clarification or add additional context in comments.

Comments

0

Instead of array, you can send them as comma separated(and hence making them as a single string) and use it according.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.