| Posted: 23 September 2009 at 8:22pm | IP Logged
|
|
|
I'm trying to figure out how to import an excel spreadsheet into a table within a SQL Server database. Searching on the internet, I found this: select *
into SQLServerTable FROM OPENROWSET('Microsoft.Jet.OLEDB.4.0',
'Excel 8.0;Database=D:\testing.xls;HDR=YES',
'SELECT * FROM [Sheet1$]')
I just slapped this code into a cf page, changed the table name, and the location and name of the spreadsheet, and tried it out. It bombs at the "From" clause. "Incorrect syntax near the keyword 'from'. Here's my statement:
<cfquery name="insert" datasource="jeffy"> insert into jefftable from openrowset('Microsoft.Jet.OLEDB.4.0', 'Excel 8.0;Database=C:\dothis.xls;HDR=YES', 'SELECT * FROM [Sheet1$]'); </cfquery>
I have no clue what I'm doing, so any help or suggestions will be appreciated.
__________________ Si hoc legere scis, nimium eruditionis habes.
|