How can I run the Bulk Copy Program (BCP) utility of SQL Server through .Net code?
+2
A:
Take a look at the SqlBulkCopy class. And there's another article with examples.
Andomar
2009-05-13 09:33:07
This will only let you INSERT data, not export it.
thomasnguyencom
2009-10-02 17:11:26
+1
A:
You can execute this SQL command in a Command object
BULK INSERT <TableName> from '<FileName>' with (FORMATFILE='<FmtFile>')
Replacing the items in angle brackets with proper item names
Binary Worrier
2009-05-13 09:35:18
A:
Here are some possible options:
- From .NET 2.0, we can use SqlBulkCopy class
- Use BULK INSERT Query
- Use an integration service package (SISS).
...and
- If you still need bcp utility, then you can run it as a process... which I will reccomend less.
NinethSense
2009-05-13 09:41:51