将DBF文件导入Sql Server [英] Import DBF files into Sql Server

查看:1316
本文介绍了将DBF文件导入Sql Server的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要一些帮助来解决这个问题,因为我对存储过程不熟悉。我正在尝试使用此存储过程将.DBF表导入Sql Server 2008.

I need a little help figuring this out because I'm new to stored procedures. I am trying to import a .DBF table into Sql Server 2008 using this store procedure.

CREATE PROCEDURE spImportDB
-- Add the parameters for the stored procedure here

AS
BEGIN

-- Insert statements for procedure here

 SELECT * into Products
 FROM OPENROWSET('vfpoledb','C:\Users\Admin\Doc\Data\DBF',
 'SELECT * FROM MyTable')

END
GO

我收到此错误。
OLE DB提供程序vfpoledb尚未注册。这不是真的,我已经安装它并且在我的其他应用程序中工作正常。

I receive this error. The OLE DB provider "vfpoledb" has not been registered.This isn't true, I've installed it and it works fine in my other application.

我也尝试使用此提供程序以这种方式运行它但我收到此错误消息
无法为链接服务器(null)初始化OLE DB提供程序Microsoft.Jet.OLEDB.4.0的数据源对象。

I've also tried running it this way with this provider but I receive this error message Cannot initialize the data source object of OLE DB provider "Microsoft.Jet.OLEDB.4.0" for linked server "(null)".

CREATE PROCEDURE spImportDB
-- Add the parameters for the stored procedure here

AS
BEGIN

-- Insert statements for procedure here

 SELECT * into Products
 FROM OPENROWSET('Microsoft.Jet.OLEDB.4.0','C:\Users\Admin\Doc\Data\DBF',
 'SELECT * FROM MyTable')

END
GO

创建此存储过程的最简单方法是什么?我希望它是一个存储过程而不是向导或程序,所以请不要给我任何程序。

What's the easiest way to create this stored procedure? I want it to be a stored procedure not a wizard or program so please don't give me any programs.

推荐答案

你可以尝试

SELECT * into SomeTable
FROM OPENROWSET('MSDASQL', 'Driver=Microsoft Visual FoxPro Driver;
SourceDB=\\SomeServer\SomePath\;
SourceType=DBF',
'SELECT * FROM SomeDBF')

来自上一个问题

这篇关于将DBF文件导入Sql Server的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆