If I execute the following command:
select
*
from
OpenRowset (
'MSDASQL',
'Driver={Microsoft Text Driver (*.txt;*.csv)};DefaultDir=C:;',
'select top 10 * from C:x.csv'
)
... then Microsoft SQL Server Management Studio responds with:
[Microsoft][ODBC Driver Manager] Data source name not found and no
default driver specified.
I'm running Microsoft SQL Server 2008 R2 on Win 7 x64. I've also tried it on Windows Vista x32, same error.
Questions:
- Has anyone successfully run this command on Win 7 x64?
- Do any of you know what could be causing the T-SQL command to fail like this?
Update 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
Update 2:
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).
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…