Monday, June 4, 2012

How to Import data in Excel sheet to SQL Express Database using AD-HOC Query

Have you tried to get data in Excel sheet to a SQL database? Here is how to do it step by step so anyone can understand it simply. So there is no need to search anymore. This is done using AD HOC query in SQL. You can either import all the columns or selected one as you prefer.


Select * into TestTable from
OPENROWSET ('Microsoft.Jet.OLEDB.4.0','Excel 8.0;Database=D:\MyTable.xls;HDR=Yes;IMEX=1', 'SELECT * FROM [Sheet1$]')


To see the detailed post on this visit Assumed Altitude by Shan Perera under Lankan Blogger

No comments:

Post a Comment