Click here to Skip to main content
15,908,776 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi,

Is it possible to bulk insert data from an Excell sheet to a table through command?
Posted

Yes, it is possible. Use the OpenRowSet function:
SQL
select * from OPENROWSET('Microsoft.Jet.OLEDB.4.0', 'Excel 8.0;Database=C:\myfile.xls', 'select * from [Sheet1$]')
 
Share this answer
 
The easiest way is to use SSIS (SQL Server Intergration Services). Otherwise there are a couple of ways to import data from excel.

1: Nice approach from code
SQL
SQL SERVER – Import CSV File Into SQL Server Using Bulk InsertLoad Comma Delimited File Into SQL Server

[^]

2: Create a linked server in SQL Server, then reference the sheet by name
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900