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
Solved

SQL Server 2000/Excel

Posted on 2013-01-15
9
258 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
  • 4
  • 4
9 Comments
 
LVL 39

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 39

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
Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

 
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 39

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 39

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

MIM Survival Guide for Service Desk Managers

Major incidents can send mastered service desk processes into disorder. Systems and tools produce the data needed to resolve these incidents, but your challenge is getting that information to the right people fast. Check out the Survival Guide and begin bringing order to chaos.

Question has a verified solution.

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

This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties

839 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