Oledb Dataprovider - Reported Error
-
Hi, Whenever am trying to run the following query insert into OPENROWSET('Microsoft.Jet.OLEDB.4.0','Excel 8.0;Database=C:\Documents and Settings\sbritto\Desktop\testing.xls;','SELECT * FROM [Sheet1$]') select * from sqlserver am getting an "Reported error". Here am trying to export the data from sqlserver to an existing excel. What's wrong in this Query. Please help me out Thanks in Advance
Regards, Samson
-
Hi, Whenever am trying to run the following query insert into OPENROWSET('Microsoft.Jet.OLEDB.4.0','Excel 8.0;Database=C:\Documents and Settings\sbritto\Desktop\testing.xls;','SELECT * FROM [Sheet1$]') select * from sqlserver am getting an "Reported error". Here am trying to export the data from sqlserver to an existing excel. What's wrong in this Query. Please help me out Thanks in Advance
Regards, Samson
You didn't specify any column names. The format for an SQL INSERT statement is:
INSERT INTO table (column1, column2, ...)
VALUES (value1, value2, ...)Also, it would appear that you need to get a recordset from the Excel sheet, append the SQL Server rows to it, then write the recordset back to the Excel sheet. This would be 3 operations instead of just the one.
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007, 2008