Tuesday, December 6, 2011

OPENDATASOURCE load data from excel

sp_configure 'show advanced options', 1;
RECONFIGURE;
sp_configure 'Ad Hoc Distributed Queries', 1;
RECONFIGURE;
GO

Drop TABLE #myTable
CREATE TABLE #myTable
(
    C1 ntext,
    C2 ntext,  
     C3 ntext,
    C4 ntext,  
     C5 ntext,
    C6 ntext,  
     C7 ntext,
    C8 ntext,   
)
SELECT * INTO #myTable FROM OPENDATASOURCE('Microsoft.Jet.OLEDB.4.0','Data Source=E:\RegStuff\Downloads\datafilesandlocationdetails\crida installation.xlsx;Extended Properties=Excel 8.0')...[Sheet2$]
select * from #myTable

No comments: