Solved

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

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

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Transfer Worksheet Data to Userform & Calculate based on Sum Range 28 45
SQL Server Pivot 5 42
copy down array 24 36
VBA Lookup Problem 2 13
This article descibes how to create a connection between Excel and SAP and how to move data from Excel to SAP or the other way around.
Recently we ran in to an issue while running some SQL jobs where we were trying to process the cubes.  We got an error saying failure stating 'NT SERVICE\SQLSERVERAGENT does not have access to Analysis Services. So this is a way to automate that wit…
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

738 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