Fastest way to import fixed len file into sql table
-
Use a bulk loader. Most database engines provide a dedicated program to do this.
I was brought up to respect my elders. I don't respect many people nowadays.
CodeStash - Online Snippet Management | My blog | MoXAML PowerToys | Mole 2010 - debugging made easier -
Use a bulk loader. Most database engines provide a dedicated program to do this.
I was brought up to respect my elders. I don't respect many people nowadays.
CodeStash - Online Snippet Management | My blog | MoXAML PowerToys | Mole 2010 - debugging made easier -
Yes.
I was brought up to respect my elders. I don't respect many people nowadays.
CodeStash - Online Snippet Management | My blog | MoXAML PowerToys | Mole 2010 - debugging made easier -
Have a read of this, assuming it's SQL Server BULK INSERT (Transact-SQL)[^]
Lobster Thermidor aux crevettes with a Mornay sauce, served in a Provençale manner with shallots and aubergines, garnished with truffle pate, brandy and a fried egg on top and Spam - Monty Python Spam Sketch
-
As other responders have said, use the System.Data.SqlClient.SqlBulkCopy class. Also, implement your own IDataReader in a class to read the file. The SqlBulkCopy contains a method called WriteToServer which has an overload that takes an IDataReader. Once this is done, you can simply create an IDataReader using a TextReader (via the class you made) and now you can simply read a row and write the row without using a lot of memory with DataTable or DataSet objects.
-
Hi, You have not mention is that one time or you have text feed in one folder. Anyway, You can create one SSIS package that can import your file data into sql server. you can schedule your SSIS package if that file is frequently updating. even you can execute package from your Code behind. you can also use bulk insert as other suggested.
Thanks -Amit Gajjar (MinterProject)