Solved

SQL Server 2000/Excel

Posted on 2013-01-15
9
254 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
 
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
Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

 
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

Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Join & Write a Comment

Everyone has problem when going to load data into Data warehouse (EDW). They all need to confirm that data quality is good but they don't no how to proceed. Microsoft has provided new task within SSIS 2008 called "Data Profiler Task". It solve th…
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.
Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.
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.

743 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now