title: Cannot read Excel file from SQL Server with multiple versions of SQL Server
body: <pre><code>EXEC sp_configure 'show advanced options', 1
  RECONFIGURE
  GO
  
  EXEC sp_configure 'ad hoc distributed queries', 1
  RECONFIGURE
  GO
  
  USE [master] 
  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
  </code></pre>
  
  <p>Reading Excel</p>
  
  <pre><code>DECLARE @SQLconnect VARCHAR(8000)
  
  SET @SQLconnect =  'SELECT * FROM OPENROWSET(''Microsoft.ACE.OLEDB.12.0'',
                         ''Excel 8.0;Database=D:\WAGES.xlsx;'', 
                         ''SELECT * FROM [Sheet2$]'')'
                         EXEC (@SQLconnect) 
  </code></pre>
  
  <p>Exception</p>
  
  <blockquote>
    <p>Msg 7399, Level 16, State 1, Line 1<br>
    The OLE DB provider "Microsoft.ACE.OLEDB.12.0" for linked server "(null)" reported an error. The provider reported an unexpected catastrophic failure.</p>
    
    <p>Msg 7303, Level 16, State 1, Line 1<br>
    Cannot initialize the data source object of OLE DB provider "Microsoft.ACE.OLEDB.12.0" for linked server "(null)".</p>
  </blockquote>
  
  <p>Sometimes it gives error sometimes it goes in infinite loop of execution.</p>
  
  <blockquote>
    <p><strong>NOTE:</strong> I am getting this error after installing SQL Server 2008 R2 over SQL Server 2012.</p>
  </blockquote>
  
  <ul>
  <li>OS: Windows 7 32-bit</li>
  <li>SQL Server 2008 R2 and SQL Server 2012 installed </li>
  </ul>