x

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, 2010 at 10:24 AM in Default

avatar 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, 2010 at 04:23 AM

avatar image

Madhivanan
1.1k 2 5 9

(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

SQL Server Central

Need long-form SQL discussion? SQLserverCentral.com is the place.

Topics:

x2091
x428
x140
x38
x22

asked: Feb 28, 2010 at 10:24 AM

Seen: 4190 times

Last Updated: Feb 28, 2010 at 10:24 AM

Copyright 2016 Redgate Software. Privacy Policy