错误:“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 ..."
问题描述
如果我执行以下命令:
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.
问题:
- 有人在 Win 7 x64 上成功运行过这个命令吗?
- 你们知道是什么原因导致 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.
- 我相信您必须添加一个空格
*.txt;
和*.csv
之间 - 不要在文件名中包含路径
这有效:
select * from OpenRowset('MSDASQL',
'Driver={Microsoft Text Driver (*.txt; *.csv)};DefaultDir=c:\;',
'select top 10 * from x.csv')
这篇关于错误:“OLE DB 提供程序"“MSDASQL"对于链接服务器“(空)";返回消息“[Microsoft][ODBC 驱动程序管理器] 未找到数据源名称...";的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!