473,405 Members | 2,344 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

Need Help Importing Data from Excel to My SQL Database

Hey guys,

I am trying to import data from an Excel spreadsheet into my SQL
database. I am running SQL 2005.

I following Microsoft's instructions for creating a linked server, and
it appeared to work. However when I run this query:

SELECT * INTO test FROM OPENQUERY(EFORMS,
'SELECT * FROM [Form Tracker Baseline$]')
I get the following error:

The OLE DB provider "Microsoft.Jet.OLEDB.4.0" for linked server
"EFORMS" reported an error. The provider did not give any information
about the error.
Msg 7303, Level 16, State 1, Line 1
Cannot initialize the data source object of OLE DB provider
"Microsoft.Jet.OLEDB.4.0" for linked server "EFORMS".
Test is the table that will receive the imported data. Eforms is the
name of my linked server, and Form Tracker Baseline is the worksheet
name.

The error sounds like it can not locate my spreadsheet. Any ideas why
I am getting this message? Is there an easier way to do this import?

Thanks,
Jan 16 '08 #1
4 2746
al*************@hotmail.com (al*************@hotmail.com) writes:
I am trying to import data from an Excel spreadsheet into my SQL
database. I am running SQL 2005.

I following Microsoft's instructions for creating a linked server, and
it appeared to work. However when I run this query:

SELECT * INTO test FROM OPENQUERY(EFORMS,
'SELECT * FROM [Form Tracker Baseline$]')
I get the following error:

The OLE DB provider "Microsoft.Jet.OLEDB.4.0" for linked server
"EFORMS" reported an error. The provider did not give any information
about the error.
Msg 7303, Level 16, State 1, Line 1
Cannot initialize the data source object of OLE DB provider
"Microsoft.Jet.OLEDB.4.0" for linked server "EFORMS".
Test is the table that will receive the imported data. Eforms is the
name of my linked server, and Form Tracker Baseline is the worksheet
name.

The error sounds like it can not locate my spreadsheet. Any ideas why
I am getting this message?
To me it sounds like SQL Server cannot find Excel at all. Do you have
SQL Server on the same machine as you have Excel?
Is there an easier way to do this import?
If I had an Excel book that I wanted to import to SQL Server, I would
save it as a comma-separated file and then use BCP. Don't really know
whether that is easier, but it's the only way I know...
--
Erland Sommarskog, SQL Server MVP, es****@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx
Jan 16 '08 #2
aj
Erland Sommarskog wrote:
If I had an Excel book that I wanted to import to SQL Server, I would
save it as a comma-separated file and then use BCP. Don't really know
whether that is easier, but it's the only way I know...
SSIS (ala OLE DB). Works like a charm....

aj

Jan 17 '08 #3
On Jan 17, 10:13*am, aj <ron...@mcdonalds.comwrote:
Erland Sommarskog wrote:
If I had an Excel book that I wanted to import to SQL Server, I would
save it as a comma-separated file and then use BCP. Don't really know
whether that is easier, but it's the only way I know...

SSIS (ala OLE DB). *Works like a charm....

aj
Ahhh just my luck. I am on the free version of 2005 so it looks like
SSIS is not available.
Jan 18 '08 #4
On Wed, 16 Jan 2008 10:13:10 -0800, al*************@hotmail.com wrote:
Hey guys,

I am trying to import data from an Excel spreadsheet into my SQL
database. I am running SQL 2005.

I following Microsoft's instructions for creating a linked server, and
it appeared to work. However when I run this query:

SELECT * INTO test FROM OPENQUERY(EFORMS,
'SELECT * FROM [Form Tracker Baseline$]')
I get the following error:

The OLE DB provider "Microsoft.Jet.OLEDB.4.0" for linked server "EFORMS"
reported an error. The provider did not give any information about the
error.
Msg 7303, Level 16, State 1, Line 1
Cannot initialize the data source object of OLE DB provider
"Microsoft.Jet.OLEDB.4.0" for linked server "EFORMS".
Test is the table that will receive the imported data. Eforms is the
name of my linked server, and Form Tracker Baseline is the worksheet
name.

The error sounds like it can not locate my spreadsheet. Any ideas why I
am getting this message? Is there an easier way to do this import?

Thanks,
I haven't set up a worksheet as a linked sever but I do read from excel
all the time:

insert into foobar
select *
from openrowset
('Microsoft.Jet.oledb.4.0',
'excel 8.0;database=dir\filename.xls',
[sheet$])

The dollar sign is required for the sheet name.

Watch out for data types conversions and verify what is loaded. I've
been burned a couple of times with these problems. Usually traced to
excel not knowing data types. In these cases, create a csv file and use

insert into foobar
select *
from opendatasource
('Microsoft.Jet.oledb.4.0',
'Data Source=directory;
extended properties="text;hdr=yes;"')...filename#fileext

Make sure OpenDataSource and OpenRowSet are enabled.

Jan 26 '08 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Little PussyCat | last post by:
Hello, I nee to write something that will transfer excel data into an SQL Server table. I have for another database application I wrote have it importing Excel spreadsheet data using cell by...
9
by: Edward S | last post by:
I budget for a Project in an Excel sheet as illustrated below. The months below are usually a 2 year period i.e. 24 months, though it could be over 24 months depending upon a Project. I then...
2
by: Mr. Bungle | last post by:
When importing excel from access I am fully aware that one can import directly into a table. Can you get as specific via code or something to import data from an excel sheet to a FORM (Not Table)...
7
by: Darren | last post by:
I have been attempting to create a reservation planning form in excel that imports Data from an Access database and inserts that information automaticly into the correct spreed sheet and the...
1
by: Geoff Jones | last post by:
Hi I have a question which I hope somebody can answer. I have written a VB application with which I want to import an Excel file, analyze the data within it and do some calculations. There are...
2
by: Snozz | last post by:
The short of it: If you needed to import a CSV file of a certain structure on a regular basis(say 32 csv files, each to one a table in 32 databases), what would be your first instinct on how to...
2
by: jason.teen | last post by:
Hi, I am having trouble importing a spreadsheet from Excel into an Access Database. I have noticed that even specifying the Cell Type of the Excel Data Cell, When I import it, still get...
2
by: ScardyBob | last post by:
Hello, I am having trouble importing data from an Excel Worksheet. When I try to import the data, everything works except certain columns that contain dates, where it replaces the date with a...
3
by: mukeshsrivastav | last post by:
dear sir i want to move form excel to access. i have 5 excel file having same formats and fields.now i want to import all data in one access table. importing one file is easy .but importing and...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.