使用C#从CSV文件中对DB2表进行BulkInsert [英] BulkInsert on DB2 table from CSV file using C#
问题描述
我有一个CSV文件,其中包含一些我们计划将数据移动到DB2表的数据(它只有一次性作业)。所以我通过C#代码计划使用BulkInsert(对不起,如果我错了,因为我对DB2没有任何知识)。因此,请建议如何在C#中编写代码以使用DB2 bulkinsert功能,也可以使用bulkinsert操作,或者是否有其他最佳方法。目前我正在考虑运行每个列表项并在表上调用insert语句。
提前谢谢。
I have a CSV file which has some amount of data for which we are planning to move the data to a DB2 table (its only one time job). So I was planning of something using BulkInsert (sorry if I am wrong as I don't have any knowledge of DB2) through C# code. So please suggest how to write the code in C# to use DB2 bulkinsert functionality, also is it preferable to use the bulkinsert operation or is there any other best possible way. Currently I am thinking of running through each list item and calling insert statement on the table.
Thanks in advance.
推荐答案
因为这是一次性循环可能只是最简单的方法。
但是,对于Oracle,我们有SQLLoader,它需要一个控制文件和数据文件,并将为您完成工作。我看了,DB2有两个看似相似的工具
DB2 LOAD和DB2 IMPORT
这里是我找到的一个链接讨论它们。
http:// www。 ibm.com/developerworks/data/library/techarticle/dm-0808khatri/ [ ^ ]
Since this is a one time job looping through might just be the easiest way to do it.
However, with Oracle we have SQLLoader which takes a control file and the data file and will do the work for you. I looked and DB2 has 2 tools that appear to be similar
DB2 LOAD and DB2 IMPORT
Here's a link I found discussing them.
http://www.ibm.com/developerworks/data/library/techarticle/dm-0808khatri/[^]
这篇关于使用C#从CSV文件中对DB2表进行BulkInsert的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!