Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2007-04-03
5
Medium Priority
?
939 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
[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
  • 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 2000 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This article describes a serious pitfall that can happen when deleting shapes using VBA.
After seeing numerous questions for Dynamic Data Validation I notice that most have used Visual Basic to solve the problem. This suggestion is purely formula based and can be used in multiple rows.
This Micro Tutorial will demonstrate how to use longer labels with horizontal bar charts instead of the vertical column chart.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

670 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