Tuesday, March 6, 2012

.NET assembly for BULK INSERT

Hi,

Is there any .NET package/module/assembly for BCPing the data into SQL
Server.
The BULK INSERT utility works fine, but we are kind of worried on
placing the data.

If there is any utility to build the data into a data structure and BCP
in into the SQL Server, please let know. It would be of great use.

Let know if I should post this elsewhere

Regards,
ThyaguThyagu (tdelli@.gmail.com) writes:

Quote:

Originally Posted by

Is there any .NET package/module/assembly for BCPing the data into SQL
Server.
The BULK INSERT utility works fine, but we are kind of worried on
placing the data.
>
If there is any utility to build the data into a data structure and BCP
in into the SQL Server, please let know. It would be of great use.


SqlClient has classes for bulk-copying. I have not used it, but a quick
look in MSDN Library telles me that you write from a datarow.

--
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pr...oads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodin...ions/books.mspx|||To add to Erland's response, the SqlBulkCopy class was introduced with .Net
Framework 2.0 (VS 2005 et. al.). SqlBulkCopy includes a WriteToServer
method that allows you to pass a DataTable, DataRow array or IDataReader.
The ColumnMappings property specifies the mappings between source and
destination columns.

--
Hope this helps.

Dan Guzman
SQL Server MVP

"Thyagu" <tdelli@.gmail.comwrote in message
news:1157727628.683912.128730@.b28g2000cwb.googlegr oups.com...

Quote:

Originally Posted by

Hi,
>
Is there any .NET package/module/assembly for BCPing the data into SQL
Server.
The BULK INSERT utility works fine, but we are kind of worried on
placing the data.
>
If there is any utility to build the data into a data structure and BCP
in into the SQL Server, please let know. It would be of great use.
>
Let know if I should post this elsewhere
>
Regards,
Thyagu
>
>

|||Thanks very much guys. This is awesome!

Regards,
Thyagu.

Dan Guzman wrote:

Quote:

Originally Posted by

To add to Erland's response, the SqlBulkCopy class was introduced with .Net
Framework 2.0 (VS 2005 et. al.). SqlBulkCopy includes a WriteToServer
method that allows you to pass a DataTable, DataRow array or IDataReader.
The ColumnMappings property specifies the mappings between source and
destination columns.
>
--
Hope this helps.
>
Dan Guzman
SQL Server MVP
>
"Thyagu" <tdelli@.gmail.comwrote in message
news:1157727628.683912.128730@.b28g2000cwb.googlegr oups.com...

Quote:

Originally Posted by

Hi,

Is there any .NET package/module/assembly for BCPing the data into SQL
Server.
The BULK INSERT utility works fine, but we are kind of worried on
placing the data.

If there is any utility to build the data into a data structure and BCP
in into the SQL Server, please let know. It would be of great use.

Let know if I should post this elsewhere

Regards,
Thyagu

No comments:

Post a Comment