Groups | Blog | Home
all groups > sql server dts > july 2004 >

sql server dts : Text import using DTS?


IT Dep
7/29/2004 4:23:58 PM
Hi

I am trying to import some text files into MS SQL 2000. I want to import
them into a table with the first column being the filename (excluding the
extension) and the second colunm being the contents of the textfile, I want
the entire textifle to fit into the one cell (ignoring any commas, etc).
Example:




Filename | Contents of the textfile
----------------------------------------------------------------------------
1 | This is the contents of the first file
2 | And the contents of the 2nd file, complete with commas!
Test | And another textfile
File | Some more text from a texfile......


Thanks in advance

Dan



Allan Mitchell
7/29/2004 4:30:59 PM
This should be relatively easy to do

The problem you will have is that a row in SQL Sever is 8KB. A text file
could possibly be much larger than that.

--
--

Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.SQLDTS.com - The site for all your DTS needs.
www.konesans.com - Consultancy from the people who know


[quoted text, click to view]

Darren Green
7/29/2004 4:35:39 PM
You will need to do some playing around, but the Read File transform is
probably best.
Have a look in Books Online.

--
Darren Green
http://www.sqldts.com

[quoted text, click to view]

IT Dep
7/29/2004 4:42:50 PM
Hi

Assuming the text files are all under 8Kb how would I go about importing
them? Thanks

Dan

[quoted text, click to view]

Allan Mitchell
7/29/2004 4:48:04 PM
As Darren says the READFILE transformation would seem to be the best way of
doing this. Turn this article on it's head.

Write File Transformation
(http://www.sqldts.com/default.aspx?294)


I will mock up an example and I can send you it privately before I put it up
on the site if you ping me.



--
--

Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.SQLDTS.com - The site for all your DTS needs.
www.konesans.com - Consultancy from the people who know


[quoted text, click to view]

Allan Mitchell
7/29/2004 6:16:22 PM
Sent to your mail address

i will make it look pretty and put it up on the site

--
--

Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.SQLDTS.com - The site for all your DTS needs.
www.konesans.com - Consultancy from the people who know


[quoted text, click to view]

AddThis Social Bookmark Button