I have a code that loads data from Excel into SQLServer table. It works fine, but I need to know if there\'s a best way to do it, I mean do the process faster. This is because i
You can use either an Excel or SQL Server reference in-line on an Excel or SQl Server connection, for example:
SELECT Col1, Col2, Col3 INTO
[ODBC;Description=TEST;DRIVER=SQL Server;SERVER=Some\Instance;Trusted_Connection=Yes;DATABASE=test].TableZ FROM [Sheet1$]"
You will probably need to enable ad hoc queries on SQL Server and if you are using ACE there may be some other considerations:
SELECT * INTO newx
FROM OPENROWSET('Microsoft.Jet.OLEDB.4.0',
'Excel 8.0;HDR=YES;IMEX=1;Database=c:\docs\testdata.xls',
'SELECT * FROM [Sheet2$]');
I cretaed a package using SSIS. This is a good solutions and from code I send parameters to Package (Package.dtsx)
The bulk load is reduced amazingly :)