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

Select specific Fields to output to CSV - Postgresql

I have a database from which i have to export to a csv/text file the longtitude and lantitude in this form: 25.767368,-80.18930 34.088808,-118.40612 40.727093,-73.97864 # Lat,Long The attributes in my database are in a correct format and i only…
Mini John
  • 7,855
  • 9
  • 59
  • 108
0
votes
1 answer

200,000 rows or info with SQLBulkCopy c#

I have a database table with 3 columns, all strings. I must upload 200,000 rows of information. I can do this but as you would expect it is taking much too long, like 30+ minutes. I am now trying to use SQLBulkCopy to do it faster but I cannot…
Peter
  • 15
  • 1
  • 4
0
votes
0 answers

BulkCopy List using FastMember

I've done BulkCopy of List using FastMember and Threading for faster Performance. Actually,I need to bulkcopy like 999999999 records and I've made an interval for every 1000000 records and Clearing the List to avoid OutofMemory Exception. The…
RealSteel
  • 1,871
  • 3
  • 37
  • 74
0
votes
1 answer

can't add datatable to sqlbulkcopy

This is my code public static void InsertToDatabase(DataTable dataTable) { using (SqlBulkCopy sbc = new SqlBulkCopy(GetConnectionString())){ sbc.DestinationTableName = tableName; sbc.WriteToServer(dataTable); } } This is the…
Agnieszka Polec
  • 1,471
  • 6
  • 20
  • 26
0
votes
2 answers

SqlBulkCopy rows from one table to another but with different columns order

I have two tables in two different servers. That tables have same columns but in different order and I cant perform bulk copy; I'm tried to do var copier = new SqlBulkCopy(destination_connection); copier.DestinationTableName =…
atomAltera
  • 1,702
  • 2
  • 19
  • 38
0
votes
2 answers

Stop SqlBulkCopy from rolling back transaction when one insert fails

I am using SqlBulkCopy to insert batches of records to a server. If one record fails because of a unique constraint, I don't want to rollback the whole batch, but I want to do an update of the existing record instead. I was hoping I could log the…
Graeme
  • 2,597
  • 8
  • 37
  • 50
0
votes
1 answer

SQLBUlkCopy to call StoredProcedure to insert or update data in SQLDb

I am having a list of records which I need to insert or update in a SQL DB based on whether the record is present or not present in the database. The current flow is I process each record 1 by 1 and then call a Stored Procedure from my C# code which…
Ankur Garg
  • 2,553
  • 8
  • 30
  • 41
0
votes
1 answer

Bulk replace of content of SQL Server tables

My ASP.NET MVC application has a number of web servers accessing a SQL Server database via Entity Framework 6. The database has 2 tables, with a one to many relationship between them. Once a day, the entire contents of both tables needs to be…
Rob Gutie
  • 31
  • 3
0
votes
2 answers

Keyword not supported: 'provider' with SqlBulkCopy

I try to write access connection string in SqlBulkCopy but I got error Keyword not supported: 'provider' here is my code: bulk = New SqlBulkCopy("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & mFileName & ";Jet OLEDB:Database…
0
votes
2 answers

move data from one table to other table with different table structure

I am creating a generic data upload app where user creates the table structure and upload the data. I have generic data table. with following structure. -------------------------------------- tableId | ColumName | rowNo | CellData now user will…
Yagnesh.Dixit
  • 318
  • 7
  • 18
0
votes
0 answers

How to we skip error with SQLBulkCopy

I am using SQLBulkCopy to upload bulk data into Sql Table.. the table contains the column ID as Identity column. so it will not allow dulicate record as you know.. Consoder that I have 10 rows to insert by SQLBulkCopy, among that 10 records we have…
Kevin M
  • 5,436
  • 4
  • 44
  • 46
0
votes
1 answer

Sql Server - Insert data in one table along with the new auto-incremented inserted ids of another table

I have 2 databases DB1 and DB2. I need to write query to copy data from DB2 to DB1. Both the databases have same table structure. For Example: CREATE TABLE DB1.Group( GroupID [int] IDENTITY(1,1) NOT NULL, [Company] [varchar](10) NOT…
0
votes
1 answer

Out of Memory exception while uploading big excel file through window service

I am facing a major problem in my application. While reading a big excel file having more then 9 hundred thousand records through oledb.jet 12.0 provider and filling it up in a dataset from the returned value after some time system through me an…
0
votes
3 answers

sqlBulk insert C#

I have a page where I want to upload a CSV file from my computer to database on the server and I have my opentext that looks like the following using (StreamReader sr = File.OpenText(@"c:\users\workstationUsername\FileName.csv")) This works fine on…
Master Page
  • 823
  • 1
  • 6
  • 9
0
votes
0 answers

SQLBulkCopy slower than expected

It's currently taking around 5 minutes per million records, I was just wondering if this is the expected speed. I was wondering if my batch size is to small i.e. 500 ? My current code looks something like this... using (var destinationConnection =…
StevieB
  • 6,263
  • 38
  • 108
  • 193