简体   繁体   English

在SQL中导入多个DBF文件

[英]Import Multiple DBF files in SQL

I have 327 .DBF files that i need to import in one table in a database in Mircosoft SQL server. 我需要在Mircosoft SQL Server的数据库的一个表中导入327个.DBF文件。 These files all have the exact same structures, and are in the same location. 这些文件都具有完全相同的结构,并且位于相同的位置。 Each file contains between 10,000 and 120,000 records. 每个文件包含10,000至120,000条记录。

I have been told that the easiest way to do this is to automate a conversion of all files to .txt then create a batch to merge all .txt files then import using the wizard. 有人告诉我,最简单的方法是将所有文件自动转换为.txt,然后创建一个批处理以合并所有.txt文件,然后使用向导导入。

Is there a way i can write a SP or other to just import the DBF files directly? 有没有办法我可以编写SP或其他文件直接导入DBF文件?

If so would appreciate some help. 如果是这样,将不胜感激。

Thanks 谢谢

You can use DBF Commander Pro for your task. 您可以将DBF Commander Pro用于您的任务。

Open a DBF file, click File -> Export to DBMS. 打开一个DBF文件,单击文件->导出到DBMS。 At the window appears Build the connection string and select the target table of the database to export data to. 在窗口中显示“生成连接字符串”,然后选择要将数据导出到的数据库的目标表。 At the bottom of the window you'll see command line for the current export process: 在窗口底部,您将看到当前导出过程的命令行: 将DBF加载到数据库

If you click on Export button then current DBF file will be exported to the database. 如果单击“导出”按钮,则当前的DBF文件将被导出到数据库。 But since you need to export 327 files, it's better to use a command line (BAT file) for this. 但是,由于您需要导出327个文件,因此最好使用命令行(BAT文件)。 So, you can create such BAT file, where every of DBF files will be exported with the command line you've got in a loop. 因此,您可以创建这样的BAT文件,其中每个DBF文件都将使用循环进入的命令行导出。 Eg: 例如:

dbfcommander.exe -edb "D:\Data\*some_filename*.dbf" destination_table "Provider=SQLOLEDB.1;User ID=user1;Initial Catalog=test_db;Data Source=test_server"

More info on export process you can find here . 您可以在此处找到有关导出过程的更多信息。 DBF Commander Pro using is described here . 这里描述使用DBF Commander Pro。 The app has 20 days fully-featured trial period, so you can perform your task absolutely for free. 该应用程序具有20天的全功能试用期,因此您可以完全免费地执行任务。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM