473,545 Members | 2,010 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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(EFORM S,
'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 2761
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(EFORM S,
'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****@sommarsk og.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...@mcdonal ds.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(EFORM S,
'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=di r\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=director y;
extended properties="tex t;hdr=yes;"').. .filename#filee xt

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
4682
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 cell, row by row method. This is fully automated so the user can choose whatever spreadsheet they want to import and press a button which sits on a...
9
4022
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 need to input this in an Access database, where I do a comparison with the Actual cost. The table “TblBudget” in Access is made of 4 fields, namely:...
2
4982
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) through a command button. For example: cell C5 on the selected excel spread sheet = textbox2 in the current form. This is for a service repair...
7
3035
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 correct cells within that worksheet. The Excel Book is made up of 12 worksheets named Jan-Dec. Each worksheet has columns labeled as each day of that...
1
2447
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 in fact five sheets in the Excel file. My original idea was to import the file into access and create a database file; which I did and worked...
2
3162
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 set this up so as to do it reliably and minimize overhead? There are currently no constraints on the destination table. Assume the user or some...
2
2349
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 Import Errors. Like Type Mismatch. The funny thing is that its all done automatically via the Wizard, so I dont even specify what the field type should...
2
1910
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 null in the access table. To import the data I do the following. 1. Create a table based on the excel spreadsheet setup with the following query...
3
3337
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 appending second file in last of the access table created earlier by importing data. thanks .plz help me.
0
7473
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7406
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7813
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
7761
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
5976
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
4949
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3457
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3444
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1020
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.