Use linked servers.
From BOL
To create a linked server against an Excel spreadsheet:
The Microsoft OLE DB Provider for Jet 4.0 can be used to access Microsoft
Excel spreadsheets.
a.. To create a linked server that accesses an Excel spreadsheet, use the
format of this example.
sp_addlinkedserver N'Excel', N'Jet 4.0',
N'Microsoft.Jet.OLEDB.4.0',
N'c:\data\MySheet.xls', NULL, N'Excel 5.0'
GO
sp_addlinkedsrvlogin N'Excel', false, sa, N'ADMIN', NULL
GO
b.. To access data from an Excel spreadsheet, associate a range of cells
with a name. A named range can be accessed by using the name of the range as
the table name. The following query can be used to access a named range
called SalesData using the linked server set up in the previous example.
SELECT *
FROM EXCEL...SalesData
--
--
Allan Mitchell (Microsoft SQL Server MVP)
MCSE,MCDBA
www.SQLDTS.com
I support PASS - the definitive, global community
for SQL Server professionals - http://www.sqlpass.org
"Daniel Jorge" <danielj (AT) afc (DOT) com.br> wrote
Quote:
Hi there,
Does anyone have an exemple of how could I make an Import and/or an
Export process in SQL Server using T-SQL and Query Analyzer to do it?
Right
now, I'm trying to export to and import from Excel files. But any exemple
would be more than welcome.
Thanks in advance
Daniel |