I need to pass a .NET Collection to a stored procedure. My collection contains 1000 records. Each record contains 2-3 child objects of other types.
All I need to insert them at once by calling stored procedure from .NET.
I already have tried a TVP (table-valued parameter), but that simply doesn't fulfills my needs.
For each and every root level record, I need to call stored procedure by passing root record and it's corresponding child records. This is making the whole process very slow.
That's why I am looking a way, so that I can pass whole hierarchical list at once, and inside stored procedure, by looping and iterating child records I can insert parent child records.
How can I achieve this?
I actually just did this 3 weeks ago.
Here are a couple of links about the process with "real" examples:
merge parent and child SQL Server tables
T-SQL - Insert Data into Parent and Child Tables