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
0 answers

sqlbulkcopy: Data truncated

When i inserted data from csv; description column data truncated with length 255. datatype for description varchar(max), nvarchar(max), text, etc tried. my code string CsvConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="…
Jkrish
  • 159
  • 2
  • 16
0
votes
1 answer

Loading a DataSet with table definitions & relations (but not data) from SQL Server

I'm not an expert with either System.Data nor SQL Server, but have a need to generate a large DataSet then use System.Data.SqlClient.SqlBulkCopy to store the results. The DataSet will consist of about 10 related tables. When SqlBulkCopy transfers…
James Hugard
  • 3,232
  • 1
  • 25
  • 36
0
votes
1 answer

sql azure batch size

Have some employee segmentation tasks that result in a large number of records (about 2000) that needs to be inserted into SQL Azure. The records themselves are very small about 4 integers. A Azure worker role performs the segmentation task and…
0
votes
1 answer

SQLBulk WritetoServer from JSON

Hi I am trying to enter large chunk of data from JSON to SQL Server, So according to what I have researched I Can Convert the JSON to DataTable and then use SQLBulk to Write the Data to Server using WriteToSever(dataTable). Is that the Best way to…
Amrit
  • 423
  • 6
  • 22
0
votes
1 answer

Using SqlBulkCopy to insert rows to a table having column of type 'xml' in SQL Server 2008 raises exception

I have simple table in SQL Server with two columns Id (BIGINT), PublishData (XML). I am interested in using SqlBulkCopy but when I try to so using SqlBulkCopy.WriteToServer(DataTable), it gives me below exception. I am using SqlXml data type in C#…
aamir
  • 47
  • 1
  • 6
0
votes
1 answer

Pattern matching on xsd:element name

I am using SQL XML bulk load to inject the data direct to the database. My XML and xsd are as the following: XML: 3.1 12/20/2001
0
votes
1 answer

SqlBulkCopy unusual TimeOut Error

I have a SqlBulkCopy operation that is taking data from an MS-Access 2007 database (via OleDbConnection) and using SqlBulkCopy to transfer that data to a SQL Server database. This has previously been working and continues to work for one MS-Access…
ChrisHDog
  • 4,473
  • 8
  • 51
  • 77
0
votes
3 answers

Date Time values in SQL Bulk Insert

i am importing some excel files to sql server using c# console application with SqlBulkcopy and receiving following exception while importing date time values. Exception: This exception is arising when we are going to do bulk copy, where one or more…
steave finner
  • 489
  • 1
  • 6
  • 18
0
votes
0 answers

Sqlbulkcopy: reduce iterations

I use C# SqlBulkCopy class to load big XML file to SQL server. I've implemented IDataReader, which loops throught XML and get values. The file contains a lot of tables, so I have to call SqlBulkCopy. WriteToServer method as many times as many tables…
Andrey Gordeev
  • 30,606
  • 13
  • 135
  • 162
0
votes
1 answer

Asp.net: Uploading excel file using blkCopy and adding user defined column

At the moment my program is uploading an excel file through the browser to the server. That excel file is then being read on the server and its value are being placed in a database. The problem I am looking to solve is I want to add one more column,…
kev670
  • 810
  • 2
  • 18
  • 37
0
votes
1 answer

Finding culprit rows on constraint failure

Any idea if it's possible to get a list of the trouble making rows in an INSERT/UPDATE statement when a constraint test fails? I'm trying to insert data with an SQLBulkCopy object reading data from a DataTable, and when the constraint fails I have…
David Catriel
  • 365
  • 7
  • 15
0
votes
1 answer

How to bulk copy similar data to two tables in SQL Server 2005?

I've 'inherited' some code that I am having a hard time working with. The application has an excel import function to import members to a members table, and SqlBulkCopy is used. A few months ago a junction table was added and two of the attributes…
Iris Classon
  • 5,752
  • 3
  • 33
  • 52
-1
votes
1 answer

Prevent SqlBulkCopy to change XML value

I am using SqlBulkCopy to transfer data from one database to another. My problem is that my XML column will be changed during the bulk copy. I think that the SqlBulkCopy class is parsing/computing the XML and "simplify" the XML. Original…
Robert Wolf
  • 191
  • 1
  • 11
-1
votes
1 answer

SqlBulkCopy error (There is already an open DataReader...)

I am trying to make an exact copy from one sql table to another. Both tables reside in the same database. I am trying to use SqlBulkCopy but receive a "There is already an open DataReader associated with this Command which must be closed first."…
newStack
  • 1
  • 3
-1
votes
2 answers

C# SQL BulkCopy datetime insert issue

I'm having an issue bulk inserting a data table containing a C# DateTime object into a SQL Server database, and keep getting the following error: The given value of type String from the data source cannot be converted to type datetime of the…
bruce_M
  • 1
  • 1
  • 3