Questions tagged [sqlbulkcopy]

Lets you efficiently bulk load a SQL Server table with data from another source.

The SqlBulkCopy class can be used to write data only to SQL Server tables. But the data source is not limited to SQL Server; any data source can be used, as long as the data can be loaded to a DataTable instance or read with a IDataReader instance.

Using the SqlBulkCopy class, you can perform:

  • A single bulk copy operation
  • List item Multiple bulk copy operations
  • List item A bulk copy operation within a transaction

Link to Microsoft Help Documentation: Microsoft SqlBulkCopy Documentation

964 questions
0
votes
1 answer

Entity Framework performance after SqlBulkCopy

I need some performance for doing some of my things. I'm trying to import excel data to my SQL Server database here is my code for doing that work but it really takes too much time for that. Could you give me some advice for that [WebMethod] …
0
votes
1 answer

Is it possible to do data type conversion on SQLBulkUpload from IDataReader?

I need to grab a large amount of data from one set of tables and SQLBulkInsert into another set...unfortunately the source tables are ALL varchar(max) and I would like the destination to be the correct type. Some tables are in the millions of…
BlueChippy
  • 5,935
  • 16
  • 81
  • 131
0
votes
1 answer

Upload bulk data into SQL Server 2008 from .csv

I want to let my users to upload 3000-4000 rows of data into SQL Server 2008. I would like to use SqlBulkCopy. What is the best policy to do it? Option A: First the .csv file will be uploaded to the server and then SqlBulkCopy operation will be…
s.k.paul
  • 7,099
  • 28
  • 93
  • 168
0
votes
2 answers

Data insert in loop using sql bulkcopy class c#

i have two database now i have to insert data from one db to another db in loop. i know bit sql bulk copy and i do not know how to insert one data at a time using sql bulk copy. here is my table structure CREATE TABLE [CandidateApplication]( …
Thomas
  • 33,544
  • 126
  • 357
  • 626
0
votes
1 answer

Does sqkbulkcopy replace table schema?

I was inserting bulk data from C# code using sqlbulkcopy.There were 15000 records in temp_upload table.Now somehow the datatable in WriteToServer() method had just one column and 37 rows. After running it I found that the table just had 37…
Rohit Raghuvansi
  • 2,824
  • 8
  • 46
  • 74
0
votes
2 answers

SQL bulk insert does not insert values properly into table

I have an Excel file(.xlsx) and I am trying to upload the content of the file into a Sql server table. Iam using the SQL bulk copy to bulk insert the data. The data gets inserted into the table but I find that the data is not inserted properly. Here…
Shiridish
  • 4,942
  • 5
  • 33
  • 64
0
votes
2 answers

Inserting unique id for file uploaded to database using SqlBulkCopy

There is a table with the following columns: ProdID Specification Value I've got a csv file with a schema that only has the last two columns - Specification and Value. In other words they are my csv headers. Now I need to associate the values of…
deostroll
  • 11,661
  • 21
  • 90
  • 161
0
votes
0 answers

SqlBulkCopy arithmetic overflow w/ .NET 4 - No issues with .Net 4.5

I'm trying to insert a massive amount of data into my database using SqlBulkCopy. I originally built this program using .NET 4.5 but it won't run on the older machine I need it to run on. During testing (with 4.5) the program worked flawlessly…
Chase
  • 564
  • 7
  • 22
0
votes
1 answer

sqlbulkcopy imports only 17837 out of 67000 rows

The sqlbulkcopy function works fine in my local environment but when I deploy it to IIS it only imports 17837 out of the 67K odd rows. Does anybody know what can cause this issue?
Mohit
  • 115
  • 6
0
votes
1 answer

No auto increment for the PK on duplicate insert with IGNORE_DUP_KEY = ON

I set IGNORE_DUP_KEY = ON so there is no warning when we try to insert lots of data. However, the primary key does increase for each duplicate row, so one could go from Id 100 to 120 when you have 20 duplicate rows after each other. Is there any way…
The Cookies Dog
  • 1,915
  • 2
  • 22
  • 38
0
votes
0 answers

SqlBulkCopy deal with batch size in ado.net

I have the following code to enter some data in the database using the class SqlBulkCopy from ADO.NET using (SqlBulkCopy bulkCopy = new SqlBulkCopy(DCISParameters.ConnectionString)) { bulkCopy.DestinationTableName =…
Giorgos Manoltzas
  • 1,710
  • 5
  • 24
  • 34
0
votes
1 answer

Return Records From SqlBulkCopy using IDataReader

I'm doing a bulk insert/update to my database by making use of the SqlBulkCopy class. After the data has inserted/updated, I want to do more logic with it. Currently, my IDataReader has a mix of records to be inserted and updated. All actions…
Ricketts
  • 5,025
  • 4
  • 35
  • 48
0
votes
1 answer

Bulk inserting with two related tables from Excel

I need to import data from an excel sheet into a database using C# WinForms. Each row is an 'Electricity Site' with a few columns of data going into the 'Sites' table. Each site also has a 'Contact' with its information (Name, Email, Phone), but…
cpiasecki
  • 47
  • 1
  • 8
0
votes
1 answer

SqlBulkCopy ColumnMappings not working

Possible Duplicate: Unable to compare the columns in SqlBulkCopy I have an excel sheet with columns : excelid | exceldata 1 | cat 2 | bat 3 | rat My database table: id (int) | varchar(50) following is my code: protected void…
Arbaaz
  • 321
  • 3
  • 13
  • 32
0
votes
1 answer

SQLBulkCopy vs DataAdapter for inserting/update 10lcs records

I have around 1,000,000+ records that I want to insert into the database. Records having same Id should be updated else inserted update/insert logic is written in Stored Proc I'm using DataAdapter.Update method to do this work. Here is the…
1Mayur
  • 3,419
  • 5
  • 40
  • 64