Reading data from excel file and inserting in to mssql table

1 create a table in the db
2 save the excel file in 97-2003 format (save it in ur c drive as the source name wont be long)
3 copy the script in your query window and execute


INSERT INTO db_banc..ExcelAccCont
SELECT *
FROM OPENROWSET('Microsoft.Jet.OLEDB.4.0',
                'Excel 8.0;Database=C:\test21.xls',
                'SELECT * FROM [Sheet1$]')

not make the name of the sheet is sheet1 or u can change according


cheers

Comments