dbTalk Databases Forums  

Do a DTS Import or Export using Query Analyzer

microsoft.public.sqlserver.dts microsoft.public.sqlserver.dts


Discuss Do a DTS Import or Export using Query Analyzer in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Daniel Jorge
 
Posts: n/a

Default Do a DTS Import or Export using Query Analyzer - 10-16-2003 , 05:10 PM






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




Reply With Quote
  #2  
Old   
Allan Mitchell
 
Posts: n/a

Default Re: Do a DTS Import or Export using Query Analyzer - 10-17-2003 , 12:39 AM






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






Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.