Solved

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

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Problems "swapping" SQL Server DBs 2 24
Copy column before Column A using a macro 6 20
simple excel formula 4 18
Formula to run in whole column: 15 16
This article shows gives you an overview on SQL Server 2016 row level security. You will also get to know the usages of row-level-security and how it works
How to get Spreadsheet Compare 2016 working with the 64 bit version of Office 2016
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
This Micro Tutorial will demonstrate how to use a scrolling table in Microsoft Excel using the INDEX function.

807 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