SQL to Excel
In our first example, we
will link an Excel sheet to an MS SQL server. The Excel example is a one-sheet
copy of the SQL Pubs table Authors.
Right-click to download the Excel Sheet
+ Open the SQL Enterprise
Manager and navigate to Security/Linked Servers. Underneath, (No items) should
be visible.
+ Right click the Linked
Server icon and select New Linked Server.
+ Create a new linked server
by entering any name in the Linked Server text box. Select "Other" as the data
source, selecting the "Microsoft Jet 4" provider. The product is "Excel." The
data source is the file path name. The Provider string is "Excel 8.0" for
Excel versions 97, 2000, and 2002. Then click OK to finish.
Now in Enterprise Manager,
under Linked Servers, the new "Excel_AUTHORS" server should appear with a table
for each Excel Sheet.
To verify your connection,
open SQL Query Analyzer and enter SELECT * FROM
EXCEL_AUTHORS...Sheet1$. (3 dots
between EXCEL_AUTHORS and Sheet1$) The author table should be returned.