如何从 DBF 文件转到 SQL Server 2008?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3119868/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to go from DBF files to SQL Server 2008?
提问by Unknown Coder
I have an application that uses DBF files and I need to import them to SQL Server 2008. However, I also need to modify some of the data along the way and some columns will be added to tables while others will be deprecated.
我有一个使用 DBF 文件的应用程序,我需要将它们导入 SQL Server 2008。但是,我还需要修改一些数据,一些列将添加到表中,而其他列将被弃用。
So far I'm using DBF -> Access -> MS Migration Assistant -> SQL Server 2008. But I think that there has to be a better way to handle it. I'd like to get away from the Migration Assistant because it doesn't let you modify the data when you import it.
到目前为止,我正在使用 DBF -> Access -> MS Migration Assistant -> SQL Server 2008。但我认为必须有更好的方法来处理它。我想远离迁移助手,因为它不允许您在导入数据时修改数据。
采纳答案by marc_s
It seems you're out of luck :-(
看来你运气不好:-(
See this note:
请参阅此说明:
Note: In SQL Server 2005, the SQL Server Import and Export Wizard does not support importing from or exporting to dBASE or other DBF files. To import DBF files, first use Microsoft Access or Microsoft Excel to import the data from DBF files into an Access database or Excel spreadsheets.Then, use the SQL Server Import and Export Wizard to import the Access database or Excel spreadsheets that contain the data from the DBF files.
注意:在 SQL Server 2005 中,SQL Server 导入和导出向导不支持从 dBASE 或其他 DBF 文件导入或导出。 要导入 DBF 文件,首先使用 Microsoft Access 或 Microsoft Excel 将 DBF 文件中的数据导入 Access 数据库或 Excel 电子表格。然后,使用 SQL Server 导入和导出向导导入包含 DBF 文件中数据的 Access 数据库或 Excel 电子表格。
Microsoft SQL Server 2005 Books Online, Choose a Data Source(Import and Export Wizard)
Microsoft SQL Server 2005 联机丛书,选择数据源(导入和导出向导)
But maybe this other Stackoverflow question can be of help??
但也许这个 Stackoverflow 的其他问题会有所帮助?
How to import a DBF file in SQL Server
Or check out some commercial and/or shareware tools for the job
或者查看一些商业和/或共享软件工具来完成这项工作
- EMS Data Import for SQL Server
- DBF to SQL Converterseems to convert DBF file content into SQL scripts
- Full Convert Enterprise
- SQL Server 的 EMS 数据导入
- DBF to SQL Converter似乎将 DBF 文件内容转换为 SQL 脚本
- 完全转换企业
回答by mindless.panda
I was able to import DBF into SQL Server 2008 by using the information at this link.
通过使用此链接中的信息,我能够将 DBF 导入 SQL Server 2008 。
In particular I:
特别是我:
- Used Import/Export wizard, selecting the "Microsoft Office 12.0 Access Database Engine OLE DB Pro..." as the Data source in the dropdown.
- Opened the Properties dialog for the Access OLE DB connection.
- Specified the folder containg the DBFsas the Data Source.
- Set Extended Properties to "dBASE 5.0"
- 使用导入/导出向导,在下拉列表中选择“Microsoft Office 12.0 Access Database Engine OLE DB Pro...”作为数据源。
- 打开了 Access OLE DB 连接的属性对话框。
- 将包含 DBF的文件夹指定为数据源。
- 将扩展属性设置为“dBASE 5.0”
I then set destination as my local sql server and upon hitting next was able to see each DBF file in the folder as a possible table/view to import from. Clicking on them created the similarly named table in the specified database.
然后我将目的地设置为我的本地 sql 服务器,并在点击下一步时能够看到文件夹中的每个 DBF 文件作为可能的表/视图导入。单击它们会在指定的数据库中创建名称相似的表。
回答by Jerry Coffin
Since you apparently just want to import the data into SQL Server, I'd just use SQL Server's Import and Export Data
, which will work with any data source for which you have an ODBC driver.
因为您显然只是想将数据导入 SQL Server,所以我只使用 SQL Server 的Import and Export Data
,它可以与您拥有 ODBC 驱动程序的任何数据源一起使用。
回答by HLGEM
From Books Online it appears that while the import/export wizard won't let you use a .dbf file, SSIS can be configured to use one:
从联机丛书看来,虽然导入/导出向导不允许您使用 .dbf 文件,但可以将 SSIS 配置为使用一个:
To configure a connection manager to connect to a dBASE or other DBF file Add a new OLE DB connection manager to the package. For more information, see How to: Add or Delete a Connection Manager in a Package.
On the Connection page of the Connection Manager dialog box, select Native OLE DB\Microsoft Jet 4.0 OLE DB Provider as the Provider.
When working with DBF files, the folder represents the database, and the individual DBF files represent tables. Therefore the Database file name text box must contain the path of the folder where the DBF file resides, and must not include the file name itself. You can type or paste in a folder path, or you can use the Browse button to select your DBF file, and then remove the file name from the end of the folder path.
On the All page of the Connection Manager dialog box, enter dBASE III, dBASE IV, or dBASE 5.0, as appropriate, as the value of Extended Properties.
Click Test Connection to validate the values that you have entered. You should see the message, "Test connection succeeded." Click OK to close the message box.
Click OK to save the configuration for the connection manager.
To use your connection manager in the data flow of the package, select an OLE DB source or destination and configure it to use the connection manager that you created by using the preceding steps.
配置连接管理器以连接到 dBASE 或其他 DBF 文件 将新的 OLE DB 连接管理器添加到包中。有关更多信息,请参见如何:在包中添加或删除连接管理器。
在连接管理器对话框的连接页面上,选择本机 OLE DB\Microsoft Jet 4.0 OLE DB 提供程序作为提供程序。
使用 DBF 文件时,文件夹代表数据库,而各个 DBF 文件代表表。因此,数据库文件名文本框必须包含 DBF 文件所在文件夹的路径,并且不得包含文件名本身。您可以键入或粘贴文件夹路径,也可以使用“浏览”按钮选择 DBF 文件,然后从文件夹路径的末尾删除文件名。
在“连接管理器”对话框的“全部”页面上,根据需要输入 dBASE III、dBASE IV 或 dBASE 5.0 作为扩展属性的值。
单击测试连接以验证您输入的值。您应该会看到消息“测试连接成功”。单击确定关闭消息框。
单击确定保存连接管理器的配置。
要在包的数据流中使用您的连接管理器,请选择 OLE DB 源或目标并将其配置为使用您通过上述步骤创建的连接管理器。