sql-server – 尝试将FoxPro DBF文件导入SQL Server

正如标题所说,我正在尝试使用openrowset将FoxPro dbf文件导入sql server.起初我尝试将DBF导出到xls文件并使用导入/导出向导导入.这通常很好用,但是有一个字段有时会保存一个非常长的字符串,并且在从dbf导出到xls期间,此字符串将被截断为4096个字符.

我找到了一个old post,其中包含如何使用openrowset执行此操作的说明.

当我尝试第一个答案时:

select *
from openrowset('MSDAsql','Driver=Microsoft Visual FoxPro Driver;
SourceDB=\\path\;
SourceType=DBF','select * from TABLE.DBF')

我收到错误

OLE DB provider "MSDAsql" for Linked Server "(null)" returned message "[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified".
Msg 7303,Level 16,State 1,Line 1
Cannot initialize the data source object of OLE DB provider "MSDAsql" for Linked Server "(null)".

当我尝试第二个答案时:

select *
from openrowset('VFPOLEDB','\\Path\';'';'','select * from TABLE.DBF')

我收到错误

Msg 7403,Line 1
The OLE DB provider "VFPOLEDB" has not been registered.

我试图用regsvr32手动注册OLE * .dll文件,但只有一些工作.在ole32,oleacc,oleaut32和oleprn上,我获得了成功的信息.在oleacchooks,oleaccrc,oledlg和oleres上我收到了这个错误

The module "oleacchooks" was loaded but the
entry-point DllRegisterServer was not found.

Make sure that "oleacchooks" is a valid DLL or OCX file
and then try again

some investigation之后我尝试安装组件,但是当我尝试为FoxPro(found here)安装msi文件时,我收到此错误

An error occurred while processing the last operation.
Error code 80110408 - Error occurred reading the application file

The event log may contain additional troubleshooting information.

所以,我正式在这里迷路了.有没有人建议如何让openrowset工作,或者其他一些导入dbf文件方法

解决方法

Pat,您可以使用DBF Commander Pro执行此任务.

Download it,安装,然后单击文件 – >导出到DBMS.在窗口中单击Build按钮以构建连接字符串:选择MS OLEDB Provider for sql Server,然后从列表中选择您的服务器,提供登录名和密码,选择一个数据库,单击OK:

在“导出到DBMS”窗口中,选择要将源DBF文件导入到的目标表,然后单击“导出”.

有关导入和导出DBF到数据库的更多信息,您可以找到here.

附:该应用程序具有20天的全功能免费试用期.

相关文章

SELECT a.*,b.dp_name,c.pa_name,fm_name=(CASE WHEN a.fm_n...
if not exists(select name from syscolumns where name=&am...
select a.*,pano=a.pa_no,b.pa_name,f.dp_name,e.fw_state_n...
要在 SQL Server 2019 中设置定时自动重启,可以使用 Window...
您收到的错误消息表明数据库 'EastRiver' 的...
首先我需要查询出需要使用SQL Server Profiler跟踪的数据库标...