Solved

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

Posted on 2007-04-03
5
923 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

Control application downtime with dependency maps

Visualize the interdependencies between application components better with Applications Manager's automated application discovery and dependency mapping feature. Resolve performance issues faster by quickly isolating problematic components.

Join & Write a Comment

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.
In this article we will get to know that how can we recover deleted data if it happens accidently. We really can recover deleted rows if we know the time when data is deleted by using the transaction log.
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.
This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.

708 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

14 Experts available now in Live!

Get 1:1 Help Now