Here is my Excel sheet, I wanted to load into SQL Server DB. So before loading into SQL Server DB, I wish to see all data in SQL Server output Viewer.
This can be achieved by OPENROWSET Command provided with SQL Server.
OPENROWSET: - Includes all connection information that is required to access remote data from an OLE DB data source.
More Details can be found here.
OPENROWSET also supports bulk operations through a built-in BULK provider that enables data from a file to be read and returned as a rowset.
Since If you don't have Microsoft Office installed, then, you can download Microsoft Access Engine which will help to load Excel sheet Data into SQL Server DB.
Query to view Excel sheet data in SQL Server output is as follows:
SELECT *
FROM OPENROWSET('Microsoft.ACE.OLEDB.12.0',
'Excel 12.0 Xml;HDR=YES;
Database=C:\Users\dhinakaran\Desktop\Sampleformslist.xlsx',
'SELECT * FROM [Sheet1$]');
- HRD = YES, if first row of Excel sheet represents COLUMN NAMES
- HRD= NO if First row represents data not column names.
Comments
Post a Comment