尝试将Excel文件导入SQL时查询中出错 [英] Error in query when trying to Import Excel file to SQL

查看:136
本文介绍了尝试将Excel文件导入SQL时查询中出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从 http://support.microsoft.com/kb/321686 得到这个代码,我做了这个例子,我试图创建一个存储过程:

 使用[Libatel] 
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

CREATE PROCEDURE [dbo]。[Import1]

AS
BEGIN
SELECT * INTO Cards IMPORTED FROM OPENDATASOURCE('Microsoft.Jet。 OLEDB.4.0',
'数据源= C:\Barcode.xls;扩展属性= Excel 8.0')... [Sheet1 $]

END
GO

但是我无法创建它,我有这个错误:


$ $ pre> 消息7308,级别16,状态1,过程Import1,第6行> OLE DB提供程序Microsoft.Jet.OLEDB.4.0不能用于分布式查询,因为提供商被配置为以单线程公寓模式运行。


解决方案


找到方法!好,我有一个64位的电脑,我卸载了我的32位办公室随PC一起,我得到64位版本,我从 http://www.microsoft.com/en-us/download/details.aspx?id=23734 ,这很漂亮很多它



I got this code from http://support.microsoft.com/kb/321686 , and i did the example , and i am trying to create a Stored Procedure :

use [Libatel]
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

CREATE PROCEDURE [dbo].[Import1]

AS
BEGIN
SELECT * INTO CardsImported FROM OPENDATASOURCE('Microsoft.Jet.OLEDB.4.0',
'Data Source=C:\Barcode.xls;Extended Properties=Excel 8.0')...[Sheet1$]

END
GO

but i can't create it , i got this error :

"Msg 7308, Level 16, State 1, Procedure Import1, Line 6>OLE DB provider 'Microsoft.Jet.OLEDB.4.0' cannot be used for distributed queries because the provider is configured to run in single-threaded apartment mode."

解决方案

Found the way ! well i have a 64 bit PC , i uninstalled my 32 bit office that came with the PC , i got the 64 bit version , i downloaded "AccessDatabaseEngine_x64.exe" from http://www.microsoft.com/en-us/download/details.aspx?id=23734 , that's pretty much it

这篇关于尝试将Excel文件导入SQL时查询中出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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