Questions tagged [bulkinsert]

Act of inserting multiple rows into a database simultaneously.

Act of inserting multiple rows into a database simultaneously.

The purpose is to speed up loading of large amounts of data into a database. Depending on the database or database drivers used, the data is generally transferred and committed to the database in large groups of rows instead of one row at a time.

Also include appropriate database tags such as or , and access methods such as , , or .

2493 questions
40
votes
12 answers

Cannot bulk load. Operating system error code 5 (Access is denied.)

For some weird reason I'm having problems executing a bulk insert. BULK INSERT customer_stg FROM 'C:\Users\Michael\workspace\pydb\data\andrew.out.txt' WITH ( FIRSTROW=0, FIELDTERMINATOR='\t', ROWTERMINATOR='\n' ) I'm confident after…
classicjonesynz
  • 4,012
  • 5
  • 38
  • 78
36
votes
8 answers

Bulk insert, SQL Server 2000, unix linebreaks

I am trying to insert a .csv file into a database with unix linebreaks. The command I am running is: BULK INSERT table_name FROM 'C:\file.csv' WITH ( FIELDTERMINATOR = ',', ROWTERMINATOR = '\n' ) If I convert the file into Windows…
John Oxley
  • 14,698
  • 18
  • 53
  • 78
36
votes
5 answers

SqlBulkCopy from a List<>

How can I make a big insertion with SqlBulkCopy from a List<> of simple object ? Do I implement my custom IDataReader ?
Patrice Pezillier
  • 4,476
  • 9
  • 40
  • 50
35
votes
4 answers

Bulk insert in Java using prepared statements batch update

I am trying to fill a resultSet in Java with about 50,000 rows of 10 columns and then inserting them into another table using the batchExecute method of PreparedStatement. To make the process faster I did some research and found that while reading…
Mrinmoy
  • 1,611
  • 3
  • 18
  • 20
35
votes
4 answers

Bulk insert using stored procedure

I have a query which is working fine: BULK INSERT ZIPCodes FROM 'e:\5-digit Commercial.csv' WITH ( FIRSTROW = 2 , FIELDTERMINATOR = ',', ROWTERMINATOR = '\n' ) but now I want to create a stored procedure for it. I have written…
Dr. Rajesh Rolen
  • 14,029
  • 41
  • 106
  • 178
35
votes
5 answers

How to insert multiple documents at once in MongoDB through Java

I am using MongoDB in my application and was needed to insert multiple documents inside a MongoDB collection . The version I am using is of 1.6 I saw an example here http://docs.mongodb.org/manual/core/create/ in the Bulk Insert Multiple…
user663724
34
votes
4 answers

How can I insert 10 million records in the shortest time possible?

I have a file (which has 10 million records) like below: line1 line2 line3 line4 ....... ...... 10 million lines So basically I want to insert 10 million records into the database. so I read the file and upload it to SQL…
MD TAHMID HOSSAIN
  • 1,581
  • 7
  • 29
  • 54
34
votes
11 answers

Determine ROW that caused "unexpected end of file" error in BULK INSERT?

i am doing a bulk insert: DECLARE @row_terminator CHAR; SET @row_terminator = CHAR(10); -- or char(10) DECLARE @stmt NVARCHAR(2000); SET @stmt = ' BULK INSERT accn_errors FROM ''F:\FullUnzipped\accn_errors_201205080105.txt'' WITH ( …
Alex Gordon
  • 57,446
  • 287
  • 670
  • 1,062
32
votes
17 answers

SQL Server Bulk insert of CSV file with inconsistent quotes

Is it possible to BULK INSERT (SQL Server) a CSV file in which the fields are only OCCASSIONALLY surrounded by quotes? Specifically, quotes only surround those fields that contain a ",". In other words, I have data that looks like this (the first…
mattstuehler
  • 9,040
  • 18
  • 78
  • 108
32
votes
10 answers

Bulk Insert to Oracle using .NET

What is the fastest way to do Bulk insert to Oracle using .NET? I need to transfer about 160K records using .NET to Oracle. Currently, I'm using insert statement and execute it 160K times.It takes about 25 minutes to complete. The source data is…
Salamander2007
  • 6,294
  • 8
  • 32
  • 26
30
votes
1 answer

How to perform a bulk update of documents in MongoDB with Java?

I'm using MongoDB 3.2 and MongoDB Java Driver 3.2. I have an array of a couple of hundreds of updated documents which should be now saved/stored in MongoDB. In order to do that, I iterate over the array and call for each document in this array the…
Mike
  • 14,010
  • 29
  • 101
  • 161
30
votes
4 answers

How to BULK INSERT a file into a *temporary* table where the filename is a variable?

I have some code like this that I use to do a BULK INSERT of a data file into a table, where the data file and table name are variables: DECLARE @sql AS NVARCHAR(1000) SET @sql = 'BULK INSERT ' + @tableName + ' FROM ''' + @filename + ''' WITH…
Gary McGill
  • 26,400
  • 25
  • 118
  • 202
29
votes
1 answer

Bulk Insert with filename parameter

I need to load a couple of thousands of data files into SQL Server table. So I write a stored procedure that receives just one parameter - file name. But.. The following doesn't work.. The "compiler" complains on @FileName parameter.. It wants just…
Ilan
  • 989
  • 2
  • 12
  • 22
29
votes
4 answers

"Column is too long" error with BULK INSERT

I am trying to run the following command to bulk insert data from a CSV file-- BULK INSERT TestDB.dbo.patent FROM 'C:\1patents.csv' WITH (FIRSTROW = 1, FIELDTERMINATOR = '^', ROWTERMINATOR='\n'); The error I am getting is this-- Msg 4866,…
Arvind
  • 6,404
  • 20
  • 94
  • 143
28
votes
3 answers

Cannot bulk load. The file "c:\data.txt" does not exist

I'm having a problem reading data from a text file into ms sql. I created a text file in my c:\ called data.txt, but for some reason ms sql server cannot find the file. I get the error "Cannot bulk load. The file "c:\data.txt" does not exist." Any…
Daniel Brink
  • 2,434
  • 4
  • 24
  • 26