Solved

Linked Server to an Excel (Office 2003) Spreadsheet from SQL Server 2005

Posted on 2007-04-03
5
926 Views
Last Modified: 2007-11-27
How do I create a Linked Server to an Excel (Office 2003) Spreadsheet from SQL Server 2005?  What is the best Provider to use?
0
Comment
Question by:tomllewis
  • 3
  • 2
5 Comments
 
LVL 16

Expert Comment

by:rboyd56
ID: 18846713
Use sp_addlinkedserver to do this. This is a sample is from Books on Line (search for sp_addlinkedserver):

EXEC sp_addlinkedserver 'ExcelSource',
   'Jet 4.0',
   'Microsoft.Jet.OLEDB.4.0',
   'c:\MyData\DistExcl.xls',
   NULL,
   'Excel 5.0'
GO

You will need to change the parameters to meet you needs. This uses the OLEDB provider for Jet 4.o, which is basically the only provider there is to get to Excel.
0
 

Author Comment

by:tomllewis
ID: 18847095
This looks good  What is the syntax for quering the spreadsheet?
0
 

Author Comment

by:tomllewis
ID: 18847124
The Excel spreadsheet is created via our AS400 and has no named ranges.  I just want all the data.
0
 
LVL 16

Accepted Solution

by:
rboyd56 earned 500 total points
ID: 18847411
Try this:

SELECT * FROM XLTEST_DMO...Sheet1$

Change the sheet name and linked server to the appropriate names.

Look at this article for more ways to query the Excel spreadsehet:

http://support.microsoft.com/kb/306397

0
 

Author Comment

by:tomllewis
ID: 18847699
Thanks for the help!
0

Featured Post

Zoho SalesIQ

Hassle-free live chat software re-imagined for business growth. 2 users, always free.

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.
This article will guide you to convert a grid from a picture into Excel format using Microsoft OneNote and no other 3rd party application.
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…
Graphs within dashboards are meant to be dynamic, representing data from a period of time that will change each time the dashboard is updated with new data. Rather than update each graph to point to a different set within a static set of data, t…

867 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

16 Experts available now in Live!

Get 1:1 Help Now