Solved

SQL Server 2000/Excel

Posted on 2013-01-15
9
263 Views
Last Modified: 2013-01-16
I have a list of Customer Numbers in Excel that I am trying to find a match in SQL Server 2000.  I am looking for a way to link SQL to the spreadsheet.  Such as below:
Can this be done with SQL Server 2000?  Any ideas of other methods.  Thanks.

SELECT * INTO XLImport3 FROM OPENDATASOURCE('Microsoft.Jet.OLEDB.4.0',
'Data Source=C:\test\xltest.xls;Extended Properties=Excel 8.0')...[Customers$]
0
Comment
Question by:fjkaykr11
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 4
9 Comments
 
LVL 40

Expert Comment

by:lcohan
ID: 38779932
How to import data from Excel to SQL Server
http://support.microsoft.com/kb/321686

How to use Excel with SQL Server linked servers and distributed queries
http://support.microsoft.com/kb/306397
0
 
LVL 3

Author Comment

by:fjkaykr11
ID: 38780472
I think I was not clear in my post. I don't want to import data from SQL to Excel, I want to do it the other way around. I want to query a list of numbers that I have an excel spreadsheet. Can I do this in SQL Server 2000?
0
 
LVL 40

Assisted Solution

by:lcohan
lcohan earned 150 total points
ID: 38780516
"
I don't want to import data from SQL to Excel, I want to do it the other way around.
I want to query a list of numbers that I have an excel spreadsheet.
"


How to import data from Excel to SQL Server
http://support.microsoft.com/kb/321686

then you "query" it into SQL right?


"Can I do this in SQL Server 2000? "

<<
Article ID: 321686 - Last Review: June 28, 2012 - Revision: 7.0

APPLIES TO
•Microsoft Excel 2000 Standard Edition
•Microsoft SQL Server 2000 Standard Edition
•Microsoft SQL Server 2000 64-bit Edition
•Microsoft Excel 2002 Standard Edition
•Microsoft Excel 97 Standard Edition
>>
0
Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

 
LVL 3

Author Comment

by:fjkaykr11
ID: 38780615
In the Link it states and I am quoting from the link:
"The samples in this article import Excel data by using:

    SQL Server Data Transformation Services (DTS)
    Microsoft SQL Server 2005 Integration Services (SSIS)
    SQL Server linked servers"  ??

I appreciate you sending me a link but I am going to need more help then this
0
 
LVL 40

Assisted Solution

by:lcohan
lcohan earned 150 total points
ID: 38782868
That is if you only read between the lines...anyway I'm trying to help here not start a mud throwing competition but the article says:

Description of the Technique
 The samples in this article import Excel data by using: •SQL Server Data Transformation Services (DTS)
•Microsoft SQL Server 2005 Integration Services (SSIS)
SQL Server linked servers
•SQL Server distributed queries

•ActiveX Data Objects (ADO) and the Microsoft OLE DB Provider for SQL Server
•ADO and the Microsoft OLE DB Provider for Jet 4.0

Requirements
 The following list outlines the recommended hardware, software, network infrastructure, and service packs that are required: •Available instance of Microsoft SQL Server 7.0 or Microsoft SQL Server 2000 or Microsoft SQL Server 2005



Anyway, what Excel version file are you trying to impost and where is it placed when you run the statement you posted above? Is it C:\test\ on the SQL server box where you run the code? What OS is on that SQL box?
0
 
LVL 40

Expert Comment

by:lcohan
ID: 38782934
And here is a method to use it via Linked Server to Excel file via SQL 2000 Management Studio:

http://support.microsoft.com/kb/306397
0
 
LVL 3

Author Comment

by:fjkaykr11
ID: 38783807
I don't think I would be doing a Linked Server.  The operating system of the server is Microsoft Server 2003
Version of Excel is 2010 but the spreadsheet is saved as .xls  (not .xlsx)
Yes the Excel file is in C:\test
0
 
LVL 12

Accepted Solution

by:
Habib Pourfard earned 350 total points
ID: 38784513
Yes, you can write the following query to select data from excel in Sql 2000:
/*
-- Run this commented code only for the first run to create a temp table
CREATE TABLE #Customer
    (
    [ID] [int] IDENTITY(1, 1) NOT NULL ,
    [Name] [varchar](50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL
    )

INSERT INTO #Customer(Name) VALUES ('John Smith')
INSERT INTO #Customer(Name) VALUES ('Bill Gates')
INSERT INTO #Customer(Name) VALUES ('Mark Zuckerberg')
*/

SELECT  *
FROM    #Customer
        INNER JOIN ( SELECT *
                     FROM   OPENROWSET('Microsoft.Jet.OLEDB.4.0',
                                       'Excel 8.0;Database=C:\CustomerIDs.xls',
                                       [Sheet1$])
                   ) Excel ON #Customer.ID = Excel.CustomerID

Open in new window

I have attached an excel file named CustomerIDs.xls
CustomerIDs.xls
0
 
LVL 3

Author Closing Comment

by:fjkaykr11
ID: 38784984
Thanks, that is what I need the T-SQL code is best for me.
0

Featured Post

Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
In the first part of this tutorial we will cover the prerequisites for installing SQL Server vNext on Linux.
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.
Via a live example, show how to setup several different housekeeping processes for a SQL Server.

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question