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

Quickest way to bulk copy between tables

I have a SQL Server table with columns, call them A and B. I have created a new table with a type column and a single value column. I want to copy all the rows (there are 50 million) from the existing table to the new one, such that for each row in…
Aidan
  • 4,783
  • 5
  • 34
  • 58
0
votes
2 answers

Bulk Copy from Table Variable

Is it possible to use BulkCopy for copying data from a table variable to Real table (SQL table) where both schema are identical?
Binu Bhasuran
  • 468
  • 1
  • 4
  • 9
0
votes
1 answer

SqlBulkCopy Timeout when used within a WCF Sercive that sets TransactionScopeRequired

Situation: WCF Service with TransactionScopeRequired OperationBehaviour. WCF Service runs a process that used SqlBulkCopy to insert many rows to a db. When used without the TransactionScopeRequired behaviour, the SqlBulkCopy inserts records with no…
kenam
  • 125
  • 8
0
votes
0 answers

SqlBulCopy.WriteToServer(DataTable) results in System.Data.SqlClient.SqlException (0x80131904)

As part of a annual process, there is a need to insert millions of records to DB. I use SqlBulkCopy.WriteToServer method to do so. When processing even a less number of records it encounter below exception. System.Data.SqlClient.SqlException…
0
votes
1 answer

Qualifying bulk copy table mappings MSSQL

I was wondering if there was a way to qualify the table mappings when using sqlbulkcopy in c#? Currently, I have a table that contains Stock Codes and then columns associated with range of weekly bucks. example: Stock Code | 11-2013 | 12-2013|…
user2859487
  • 23
  • 1
  • 2
  • 5
0
votes
1 answer

How to do PostgreSQL Bulk INSERT without Primary Key Violation

I'm trying to achieve database abstraction in my project, but now I got stuck with doing a bulk INSERT in PostgreSQL. My project is in C# and I'm using PostgreSQL 9.3 with npgsql.dll 2.0.14. For Microsoft SQL Server I'm doing the bulk INSERT simply…
Loonis
  • 115
  • 2
  • 10
0
votes
0 answers

What permission Required from DB :Microsoft SQL Server 2008 R2 required to make Bulk Insert from .NET using SqlBulkCopy

What exact minimum permission Required from DB :Microsoft SQL Server 2008 R2 required to make Bulk Insert from .NET using SqlBulkCopy. If not required to give full access on DB, can it be done for a specific table. IS bulkadmin the answer?
0
votes
0 answers

SQLBulkCopy error for bracelets (String or binary data would be truncated)

I try to import an excel file, and in one of cells it contains the following bracelet character "(" and If I don't remove this character, it results with the below errors. If I remove the character there is no error. How to solve the issue…
HOY
  • 1,067
  • 10
  • 42
  • 85
0
votes
1 answer

What's the fastest way to perform large inserts with foreign key relationships and preprocessing?

I need to regularly import large (hundreds of thousands of lines) tsv files into multiple related SQL Server 2008 R2 tables. The input file looks something like this (it's actually even more complex and the data is of a different nature, but what I…
0
votes
1 answer

LINQ query IEnumerable for IEnumerable results in null
Why is my LINQ query ("rows") showing up as a null when it seems like I have plenty of data ("waypoints")? I'm doing an insert of ~20k records and rather than go through Entity Framework I've opted for SqlBulkCopy, which seems to mean I need a…
Eric
  • 2,273
  • 2
  • 29
  • 44
0
votes
2 answers

SQL Server 2005: Improving performance for thousands or Insert requests. logout-login time= 120ms

Can somebody shed some lights on how SQL Server 2005 deals with may request issued by a client using ADO.NET 2.0. Below is the shortend output of SQL Trace. I can see that connection pooling is working (I believe there is only one connection being…
0
votes
0 answers

SqlBulkCopy.WriteToServer fails randomly

Scenario : I have a asp.net web service that uses SQL Server 2008. It is supposed to perform some long running DB updates and it involves bulk inserting records to 3 tables in 1 request. There are approximately 220 such requests. Flow for the a…
Jyotsna Sonawane
  • 303
  • 1
  • 3
  • 17
0
votes
1 answer

Update 1 column using bulkinsert C#

I have dataabase of 2.5 million records. One column in database is empty. Now i want to fill that column by inserting in Bulk, because a simple update query takes a lot of time. But the problem is that bulkinsert starts inserting record at the end,…
Zia ur Rehman
  • 331
  • 1
  • 2
  • 20
0
votes
2 answers

Update SQL server table using Datatbale

I have in memory table(DataTable), I want to update SQL table with the help of the DataTable in one go(Bulk update). I know how to bulk insert data from DataTable to SQL table. Is there a way to bulk update ?
Jainendra
  • 24,713
  • 30
  • 122
  • 169
0
votes
3 answers

.NET BulkCopy Only Firing Trigger On One Insert

I perform a trigger on each insert on a table. I am using bulkcopy to do a bulk insert into this table. I read FireTriggers will fire my trigger on the table, but it only does it one time, not for each insert. The trigger takes some data from the…
Mike Flynn
  • 22,342
  • 54
  • 182
  • 341