May 5th, 2011, 11:03 PM
uptading bulk to db
I was working on a task where we need to insert upto 3 lakhs of records to a table at one time. I am using ASp.Net 2.0 and SQL server 2005
I was trying to pass the data to the sql stored procedure as xml and do the insertion inside the SP.
The xml is of following structrure
<p pid='23' sid='22'/>
<p pid='23' sid='24'/>
The P tag is recurring and it can be up to 3 lakhs of records.
I am creating the xml from two listbox values. The value of pid comes from one listbox and value of sid comes from another listbox. The actual thing here doing is mapping the items in both database together.
Take the first value of first list box and map to all the values in second listbox, then take 2nd value and map to all values in second listbox and so on..
But even the xml creation itself is take too much of time, when both listbox contains 500 items each.
Is there any way i can achive this.
I was planning to check SqlBulkCopyin ADO.Net. But here one issue is some records which we are tyring to insert will already be in the database table and inserting them again will show Primary key error.
I am not sure how the sqlBulkcopy will behave is such error occures while inserting.
Can anyone please help me
Tags for this Thread
Click Here to Expand Forum to Full Width
This a Codeguru.com survey!