Solved

SQL Server 2000/Excel

Posted on 2013-01-15
9
259 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
Forrester Webinar: xMatters Delivers 261% ROI

Guest speaker Dean Davison, Forrester Principal Consultant, explains how a Fortune 500 communication company using xMatters found these results: Achieved a 261% ROI, Experienced $753,280 in net present value benefits over 3 years and Reduced MTTR by 91% for tier 1 incidents.

 
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

Space-Age Communications Transitions to DevOps

ViaSat, a global provider of satellite and wireless communications, securely connects businesses, governments, and organizations to the Internet. Learn how ViaSat’s Network Solutions Engineer, drove the transition from a traditional network support to a DevOps-centric model.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
unable to reinstall SCVMM 2012 R2 - SQL errors. 5 41
SQL Select Query help 1 38
Linked Server - SP with Param to VIew 7 22
Connect Gridview column to Textbox in C# 2 41
Occasionally there is a need to clean table columns, especially if you have inherited legacy data. There are obviously many ways to accomplish that, including elaborate UPDATE queries with anywhere from one to numerous REPLACE functions (even within…
For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function
Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.

733 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