Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

importing excel file as a database table

Status
Not open for further replies.

lagazetta

Technical User
May 3, 2007
8
CA
hi there,

I am using MS SQL 2005.

i have an name.xls file (has 3 columns in one worksheet) that needs to be uploaded as a table with 3 fields (corresponding to the columns in my excel sheet) into my database.

i ran the following:

select *
from openrowset('microsoft.jet.oledb.4.0',
'Excel 8.0;database=[filepathandname],
'select * from [Sheet1$]')

i got this:

Msg 156, Level 15, State 1, Line 4
Incorrect syntax near the keyword 'select'.
Msg 105, Level 15, State 1, Line 4
Unclosed quotation mark after the character string ')
'.

may you have a better solution for this upload?

thanks




 
If you count the number ofapostrophes you will see that one does not have a partner. That's what the message is telling you.

Questions about posting. See faq183-874
 
Use the Import Wizard to bring in the excel worksheet. What you are doing there is creating a view, not a table.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top