x
login about faq Site discussion (meta-askssc)

How to import data from Excel file on local machine to Sql Server using Query

Hi !

I am trying to import excel table into my sql database.

My excel file is on my local machine and I tried this code :

SELECT * FROM OPENROWSET('Microsoft.Jet.OLEDB.4.0', 'Excel 8.0;Database=Q:\Documents and Settings\Administrator\My Documents\myfile.xls', 'SELECT * FROM [QPrintPolicyRenew$]')

I keep getting this error :

Cannot get the column information from OLE DB provider "Microsoft.Jet.OLEDB.4.0" for linked server "(null)".

Can anyone help ??

more ▼

asked Feb 28 '10 at 10:24 AM in Default

gil eichenbaum gravatar image

gil eichenbaum
1 1 1 1

(comments are locked)
10|1200 characters needed characters left

1 answer: sort voted first

The first line of the EXCEL file should have column informations Refer this for more informations http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=49926

more ▼

answered Mar 03 '10 at 04:23 AM

Madhivanan gravatar image

Madhivanan
1.1k 1 2 6

(comments are locked)
10|1200 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments



Facebook logo Follow Ask SSC on Facebook
Find Ask SSC on Google+
linkedin logo Find us on LinkedIn

Topics:

x1601
x321
x98
x25
x14

asked: Feb 28 '10 at 10:24 AM

Seen: 2315 times

Last Updated: Feb 28 '10 at 10:24 AM

Copyright © 2002-2012 Simple Talk Publishing. All Rights Reserved. If you have any queries, please contact the site administrators.
Ask SQL Server Central is a community service provided by Red Gate.