Showing posts with label excel data into sql server. Show all posts
Showing posts with label excel data into sql server. Show all posts

Friday, February 17, 2012

Get the data from excel sheet to sql server


we can use the query according to our system requirement for example i have my system configuration like below:
os :windows 2003 server
sql server: 2005
ms excel: 2007
i select data from excel using the following configuration and query.
EXEC sp_configure 'show advanced options', 1;
GO
RECONFIGURE;
GO
EXEC sp_configure 'Ad Hoc Distributed Queries', 1;
GO
RECONFIGURE;
GO

SELECT * FROM
OPENROWSET
(
'MICROSOFT.ACE.OLEDB.12.0',
'EXCEL 12.0;DATABASE=D:example.XLSX;',
'SELECT * FROM [SHEET1$]'
)