Click here to Skip to main content
15,911,848 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Good Morning friendz,

I have a unique problem to saving data in SQL Server 2005.

I have a text file in which there are large number of data, eg. 10L records in each file. And while saving the these data to database I am using SQL insert query in loop.
I have used System.IO namespace to interact with text file. And functions from StreamReader class(.NET Framework is 2.0).

It is saving data properly but taking to much time for the same.
And that's my problem.
It's taking almost 20 to 25 minutes to save data.

Is there any time saving way to save data in database ?

Please guide on the same.
Thanks in adv.
Posted

1 solution

SQL Server is notoriously bad in this regard, take a look at Bulk Insert here:
BULK INSERT (Transact-SQL)[^]

Using BULK INSERT to Load a Text File[^]
 
Share this answer
 
Comments
Harshad-HBK 22-Oct-11 5:36am    
Thanks for your valuable guidance Chief..
I got my solution.
Thanks 1s again..

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900