Tuesday, December 3, 2013

read excel file in sql server

Here the code to read excel file from sql server

SELECT * FROM OPENROWSET('Microsoft.Jet.OLEDB.4.0','Excel 8.0;Database=D:\sheet(3-12-2013).xls','SELECT *  FROM [Sheet1$]')

Modify database path

but it gives while excuting query to overcome the problem Excute below syntex:

sp_configure 'Ad Hoc Distributed Queries', 1;
RECONFIGURE;

and then

sp_configure 'show advanced options', 1;
RECONFIGURE;

Now the above query will work..



No comments:

Post a Comment