Skip to content

Instantly share code, notes, and snippets.

@robsonalves
Created October 6, 2015 15:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save robsonalves/0e4808db020bd71965c9 to your computer and use it in GitHub Desktop.
Save robsonalves/0e4808db020bd71965c9 to your computer and use it in GitHub Desktop.
SELECT XLSX
sp_configure 'show advanced options', 1;
GO
RECONFIGURE;
GO
sp_configure 'Ad Hoc Distributed 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
select * FROM OPENROWSET('Microsoft.ACE.OLEDB.12.0', 'Excel 12.0;Database=C:\TurmaCorrigido.xlsx;HDR=YES', 'SELECT * FROM [Sheet1$]')
-- http://www.microsoft.com/en-us/download/details.aspx?id=13255
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment