ramlicious Blogs by Tina & Prabhu

August 12, 2010

Querying Excel Recordset using OPENROWSET

Filed under: SQL Server — Prabhuram @ 6:22 am

We saw how to query a recordset and update to an Excel file in Exporting Recordsets to an Excel using OPENROWSET, and now we will see the simplest example to read a recordset from Excel using OPENROWSET. All you need is this:

SELECT * FROM
OPENROWSET('Microsoft.Jet.OLEDB.4.0', 'Excel 8.0;Database=E:\NWind.xls;', 'SELECT * FROM [Sheet1$]')
WHERE Country = 'USA'

No Comments »

No comments yet.

RSS feed for comments on this post. TrackBack URL

Leave a comment

You must be logged in to post a comment.

Powered by WordPress