OPENROWSET avec file Excel

Je souhaite exécuter une déclaration simple:

SELECT * FROM OPENROWSET('MICROSOFT.JET.OLEDB.4.0','Text;Database=C:\Temp\;','SELECT * FROM [test.csv]') 

Et soudain, je reçois ce message aujourd'hui matin:

 Msg 7308, Level 16, State 1, Line 1 OLE DB provider 'MICROSOFT.JET.OLEDB.4.0' cannot be used for dissortingbuted queries because the provider is configured to run in single-threaded apartment mode. Msg 7308, niveau 16, état 1, ligne 1 Msg 7308, Level 16, State 1, Line 1 OLE DB provider 'MICROSOFT.JET.OLEDB.4.0' cannot be used for dissortingbuted queries because the provider is configured to run in single-threaded apartment mode. 

Il fonctionnait jusqu'à aujourd'hui matin!

Voici les spécifications de mon server: Windows 2008 R2 64 bits SQL Server 2008 64 bits

J'ai installé AccessDatabaseEngine_x64.exe.

Sql Server s'exécute sous le count LocalService. J'ai configuré tout le monde pour avoir l'autorisation FullControl pour "C: \ Temp" ainsi que "C: \ Windows \ ServiceProfiles \ LocalService \ AppData \ Local".

Y at-il quelque chose que j'ai manqué? Je suis vraiment confus…

Edité: J'ai également exécuté ces déclarations:

 sp_configure 'show advanced options', 1; GO RECONFIGURE; GO sp_configure 'Ad Hoc Dissortingbuted Queries', 1; GO RECONFIGURE; GO EXEC master.dbo.sp_MSset_oledb_prop N'Microsoft.ACE.OLEDB.12.0′, N'AllowInProcess', 1 GO EXEC master.dbo.sp_MSset_oledb_prop N'Microsoft.ACE.OLEDB.12.0′, N'DynamicParameters', 1 GO sp_configure 'afficher les options avancées', 1; sp_configure 'show advanced options', 1; GO RECONFIGURE; GO sp_configure 'Ad Hoc Dissortingbuted Queries', 1; GO RECONFIGURE; GO EXEC master.dbo.sp_MSset_oledb_prop N'Microsoft.ACE.OLEDB.12.0′, N'AllowInProcess', 1 GO EXEC master.dbo.sp_MSset_oledb_prop N'Microsoft.ACE.OLEDB.12.0′, N'DynamicParameters', 1 GO RECONFIGURATION; sp_configure 'show advanced options', 1; GO RECONFIGURE; GO sp_configure 'Ad Hoc Dissortingbuted Queries', 1; GO RECONFIGURE; GO EXEC master.dbo.sp_MSset_oledb_prop N'Microsoft.ACE.OLEDB.12.0′, N'AllowInProcess', 1 GO EXEC master.dbo.sp_MSset_oledb_prop N'Microsoft.ACE.OLEDB.12.0′, N'DynamicParameters', 1 GO sp_configure 'Ad Hoc Dissortingbuted Queries', 1; sp_configure 'show advanced options', 1; GO RECONFIGURE; GO sp_configure 'Ad Hoc Dissortingbuted Queries', 1; GO RECONFIGURE; GO EXEC master.dbo.sp_MSset_oledb_prop N'Microsoft.ACE.OLEDB.12.0′, N'AllowInProcess', 1 GO EXEC master.dbo.sp_MSset_oledb_prop N'Microsoft.ACE.OLEDB.12.0′, N'DynamicParameters', 1 GO RECONFIGURATION; sp_configure 'show advanced options', 1; GO RECONFIGURE; GO sp_configure 'Ad Hoc Dissortingbuted Queries', 1; GO RECONFIGURE; GO EXEC master.dbo.sp_MSset_oledb_prop N'Microsoft.ACE.OLEDB.12.0′, N'AllowInProcess', 1 GO EXEC master.dbo.sp_MSset_oledb_prop N'Microsoft.ACE.OLEDB.12.0′, N'DynamicParameters', 1 GO EXEC master.dbo.sp_MSset_oledb_prop N'Microsoft.ACE.OLEDB.12.0 ', N'AllowInProcess', 1 sp_configure 'show advanced options', 1; GO RECONFIGURE; GO sp_configure 'Ad Hoc Dissortingbuted Queries', 1; GO RECONFIGURE; GO EXEC master.dbo.sp_MSset_oledb_prop N'Microsoft.ACE.OLEDB.12.0′, N'AllowInProcess', 1 GO EXEC master.dbo.sp_MSset_oledb_prop N'Microsoft.ACE.OLEDB.12.0′, N'DynamicParameters', 1 GO EXEC master.dbo.sp_MSset_oledb_prop N'Microsoft.ACE.OLEDB.12.0 ', N'DynamicParameters', 1 sp_configure 'show advanced options', 1; GO RECONFIGURE; GO sp_configure 'Ad Hoc Dissortingbuted Queries', 1; GO RECONFIGURE; GO EXEC master.dbo.sp_MSset_oledb_prop N'Microsoft.ACE.OLEDB.12.0′, N'AllowInProcess', 1 GO EXEC master.dbo.sp_MSset_oledb_prop N'Microsoft.ACE.OLEDB.12.0′, N'DynamicParameters', 1 GO 

J'ai également testé ACE.OLEDB.12.0 avec un count administrateur:

 SELECT * FROM OPENROWSET('MICROSOFT.ACE.OLEDB.12.0','Text;Database=C:\Temp\;','SELECT * FROM [test.csv]') SELECT * FROM SELECT * FROM OPENROWSET('MICROSOFT.ACE.OLEDB.12.0','Text;Database=C:\Temp\;','SELECT * FROM [test.csv]') 

Il y a une autre erreur:

 OLE DB provider "MICROSOFT.ACE.OLEDB.12.0" for linked server "(null)" returned message "Unspecified error". Msg 7303, Level 16, State 1, Line 1 Cannot initialize the data source object of OLE DB provider "MICROSOFT.ACE.OLEDB.12.0" for linked server "(null)". Fournisseur OLE DB "MICROSOFT.ACE.OLEDB.12.0" pour le server lié "(null)" message renvoyé "Erreur non spécifiée". OLE DB provider "MICROSOFT.ACE.OLEDB.12.0" for linked server "(null)" returned message "Unspecified error". Msg 7303, Level 16, State 1, Line 1 Cannot initialize the data source object of OLE DB provider "MICROSOFT.ACE.OLEDB.12.0" for linked server "(null)". Msg 7303, niveau 16, état 1, ligne 1 OLE DB provider "MICROSOFT.ACE.OLEDB.12.0" for linked server "(null)" returned message "Unspecified error". Msg 7303, Level 16, State 1, Line 1 Cannot initialize the data source object of OLE DB provider "MICROSOFT.ACE.OLEDB.12.0" for linked server "(null)". 

Finalement, je l'ai trouvé: j'ai couru ProcMon et j'ai vu que Sql Server voulait accéder à F: \ Windows Temp \ et le dossier n'existe pas! J'ai créé le dossier et le problème est résolu. Mais, je n'ai jamais eu un tel dossier!

Finalement, je l'ai trouvé: j'ai couru ProcMon et j'ai vu que SQL Server souhaite accéder à F:\Windows Temp\ et le dossier n'existe pas! J'ai créé le dossier et le problème est résolu. Mais, je n'ai jamais eu un tel dossier!