正如标题所说,我正在尝试使用openrowset将FoxPro dbf文件导入到sql server中。首先,我尝试将DBF导出为xls文件,并使用Import/Export向导进行导入。这在正常情况下工作得很好,但是有一个字段有时包含非常长的字符串,在从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, Level 16, State 1, 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文件的方法?
发布于 2013-11-02 00:39:03
帕特,你可以使用DBF指挥官专业版来完成这个任务。
Download it,安装,然后单击文件->导出到DBMS。在出现的窗口中,单击Build按钮以构建连接字符串:选择MS OLEDB Provider for SQL Server,然后从列表中选择您的服务器,提供登录名和密码,选择一个数据库,单击OK:
在导出到DBMS窗口中,选择要将源DBF文件导入到的目标表,然后单击导出。
有关将DBF导入和导出到数据库的更多信息,可以在here中找到。
附注。该应用程序有全功能免费试用20天的期限。
发布于 2013-11-01 21:41:49
尝试使用VFPOLEDB.1作为提供程序。您可能遇到驱动程序版本问题。
https://stackoverflow.com/questions/19727768
复制相似问题