Groups | Blog | Home
all groups > sql server dts > november 2003 >

sql server dts : importing files into their own table



simon whale
11/20/2003 12:44:05 PM
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

Allan Mitchell
11/20/2003 1:44:16 PM
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%20Server\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



[quoted text, click to view]

AddThis Social Bookmark Button