LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Import Excel Data to SQL Server


Not sure if I am posting in the right forum but I really need help.

I am trying to import data from Excel to an Access database using SQL
functions. I keep getting the "FROM clause syntax error". I matched my
output with the requirement on MS website and am pretty sure I have the
syntax right. Can someone help? Thanks.

Here is my code.

strSQL = "SELECT * INTO [" & sheetName & "] FROM " & _
"OPENROWSET('Microsoft.Jet.OLEDB.4.0', " & _
"'Excel 8.0;Database=C:\clients\CTim\test2.xls;', " & _
"'SELECT * FROM [" & sheetName & "$]')"
Debug.Print strSQL
cn.Execute strSQL, lngRecsAff, adExecuteNoRecords


--
ryu
------------------------------------------------------------------------
ryu's Profile: http://www.thecodecage.com/forumz/member.php?userid=602
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=122445

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
how do I import data in excel form SQL server? Mitch Excel Worksheet Functions 7 April 15th 10 03:49 PM
Import data from Excel to SQL Server 2005 [email protected] Excel Discussion (Misc queries) 0 January 22nd 09 11:29 PM
import data into SQL Server from Excel Rachel[_2_] Excel Discussion (Misc queries) 1 October 27th 08 02:35 AM
Import data from MS Sql Server to Excel mesarim Excel Programming 1 October 29th 07 05:31 PM
How to import data from SQL Server amit Excel Discussion (Misc queries) 0 January 15th 07 05:35 AM


All times are GMT +1. The time now is 06:13 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"