dbTalk Databases Forums  

importing files into their own table

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


Discuss importing files into their own table in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
simon whale
 
Posts: n/a

Default importing files into their own table - 11-20-2003 , 06:44 AM






Hi,

i have several hundred text files that i need to import into a SQL driven
Database in thier own tables. Each table name is taken from their filename.
Is this possible through DTS? if so how and can you point me to some links?

Many thanks
Simon



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

Default Re: importing files into their own table - 11-20-2003 , 07:44 AM






Yes it is possible.

Are you wanting to generate the tables dynamically or do they exist already
?

I personally would probably look to a method which looks at the files in a
directory and place their path in a database table. I would then run over
the top of the table and do somethinig not too dissimilar to

From BOL
mk:@MSITStore:C:\Program%20Files\Microsoft%20SQL%2 0Server\80\Tools\Books\acd
ata.chm::/ac_8_qd_12_6a44.htm


--Create a linked server.
EXEC sp_addlinkedserver txtsrv, 'Jet 4.0',
'Microsoft.Jet.OLEDB.4.0',
'c:\data\distqry',
NULL,
'Text'
GO

--Set up login mappings.
EXEC sp_addlinkedsrvlogin txtsrv, FALSE, NULL, Admin, NULL
GO

--List the tables in the linked server.
EXEC sp_tables_ex txtsrv
GO

--Query one of the tables: file1#txt
--using a 4-part name.
SELECT *
FROM txtsrv...[file1#txt]

--

----------------------------
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



"simon whale" <simon (AT) nospam (DOT) ukdatait.co.uk> wrote

Quote:
Hi,

i have several hundred text files that i need to import into a SQL driven
Database in thier own tables. Each table name is taken from their
filename.
Is this possible through DTS? if so how and can you point me to some
links?

Many thanks
Simon





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.