错误:“OLE DB 提供程序"“MSDASQL"对于链接服务器“(空)";返回消息“[Microsoft][ODBC 驱动程序管理器] 未找到数据源名称..."; [英] Error: "OLE DB provider "MSDASQL" for linked server "(null)" returned message "[Microsoft][ODBC Driver Manager] Data source name not found ..."

查看:204
本文介绍了错误:“OLE DB 提供程序"“MSDASQL"对于链接服务器“(空)";返回消息“[Microsoft][ODBC 驱动程序管理器] 未找到数据源名称...";的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我执行以下命令:

select 
    * 
from 
    OpenRowset (
        'MSDASQL',
        'Driver={Microsoft Text Driver (*.txt;*.csv)};DefaultDir=C:\;',
        'select top 10 * from C:\x.csv'
    )

... 然后 Microsoft SQL Server Management Studio 响应:

... then Microsoft SQL Server Management Studio responds with:

[Microsoft][ODBC 驱动程序管理器] 未找到数据源名称且没有指定了默认驱动程序.

[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified.

我在 Win 7 x64 上运行 Microsoft SQL Server 2008 R2.我也在 Windows Vista x32 上试过,同样的错误.

I'm running Microsoft SQL Server 2008 R2 on Win 7 x64. I've also tried it on Windows Vista x32, same error.

问题:

  1. 有人在 Win 7 x64 上成功运行过这个命令吗?
  2. 你们知道是什么原因导致 T-SQL 命令像这样失败吗?

<小时>

更新 1:

如果您收到提及即席查询"的错误,请运行以下命令以消除它:

If you get an error that mentions "ad hoc queries", run the following to eliminate it:

EXEC sp_configure 'show advanced options', 1;
GO
RECONFIGURE;
GO
EXEC sp_configure 'Ad Hoc Distributed Queries', 1;
GO
RECONFIGURE;
GO

<小时>

更新 2:

它可以在开箱即用的 Win7 x64 机器上运行,但我仍然无法在我的机器上修复此错误.我将使用批量插入"(请参阅​​下面的评论).

It works on an out-of-the-box Win7 x64 machine, but I still can't fix this error on my machine. I'll go with "bulk insert" (see my comments below).

推荐答案

我刚刚在 x64 Win7 上尝试过,并且成功了.我认为有几个问题.

I just tried it on x64 Win7 and made it work. I think there are a couple problems.

  1. 我相信您必须添加一个空格*.txt;*.csv
  2. 之间
  3. 不要在文件名中包含路径

这有效:

select * from OpenRowset('MSDASQL', 
         'Driver={Microsoft Text Driver (*.txt; *.csv)};DefaultDir=c:\;', 
         'select top 10 * from x.csv')

这篇关于错误:“OLE DB 提供程序"“MSDASQL"对于链接服务器“(空)";返回消息“[Microsoft][ODBC 驱动程序管理器] 未找到数据源名称...";的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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