January 6, 2012

Select records from excel file in SQL Server

Using OPENROWSET we can directly read data from excel in SQL Server.

SELECT *
FROM OPENROWSET
('Microsoft.Jet.OLEDB.4.0', 'Excel 8.0;Database=C:\Inventory.xls;HDR=YES',
'SELECT * FROM [Inventory$]') AS Inventory

That’s It.
Enjoy Learning.

No comments:

Post a Comment