Unix Technical Forum

Text file import with DTS

This is a discussion on Text file import with DTS within the SQL Server forums, part of the Microsoft SQL Server category; --> Does anyone know if it's possible to use the wizard or DTS Designer to accept a source file with ...


Go Back   Unix Technical Forum > Database Server Software > Microsoft SQL Server > SQL Server

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-28-2008, 08:02 PM
Dave Stone
 
Posts: n/a
Default Text file import with DTS

Does anyone know if it's possible to use the wizard or DTS Designer to
accept a source file with the following simplified format:

<field1label>: <record1field1value>
<field2label>: <record1field2value>
- - - - - - -
<fieldNlabel>: <record1fieldNvalue>

<field1label>: <record2field1value>
<field2label>: <record2field2value>
etc.

i.e. each input record is delimited by {LF}{LF}, and each column by {LF}. Or
will it be necessary to write a Perl script (say) to convert it first into a
..csv file?

Thanks,

Dave

--
************************************************** **********************
Dave Stone e-mail: D.Stone@ed.ac.uk
Computing Services Telephone: +44 131-650-3314
University of Edinburgh Internal ext: 503314
Main Library, George Square FAX: 0131-650-3308
Edinburgh EH8 9LJ
************************************************** **********************


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 02-28-2008, 08:02 PM
Chuck Conover
 
Posts: n/a
Default Re: Text file import with DTS

Dave,
I'm not sure if your problem is related to the delimiter or the file
format. If the problem is the delimiter and you can't get the file to read
in at all, then not sure I can help without an actual sample of the file and
some testing.
If the problem is the file format, then I would suggest first reading
your file into a temp table and then running a procedure to massage and make
any data corrections, and insert the massaged data into your production
tables.
I use this for all my DTS packages, even if they are very similar to my
production tables just so I can do any data checking first.

Best regards,
Chuck Conover
www.TechnicalVideos.NET




"Dave Stone" <D.Stone@ed.ac.uk> wrote in message
news:c101qi$dlu$1@scotsman.ed.ac.uk...
> Does anyone know if it's possible to use the wizard or DTS Designer to
> accept a source file with the following simplified format:
>
> <field1label>: <record1field1value>
> <field2label>: <record1field2value>
> - - - - - - -
> <fieldNlabel>: <record1fieldNvalue>
>
> <field1label>: <record2field1value>
> <field2label>: <record2field2value>
> etc.
>
> i.e. each input record is delimited by {LF}{LF}, and each column by {LF}.

Or
> will it be necessary to write a Perl script (say) to convert it first into

a
> .csv file?
>
> Thanks,
>
> Dave
>
> --
> ************************************************** **********************
> Dave Stone e-mail: D.Stone@ed.ac.uk
> Computing Services Telephone: +44 131-650-3314
> University of Edinburgh Internal ext: 503314
> Main Library, George Square FAX: 0131-650-3308
> Edinburgh EH8 9LJ
> ************************************************** **********************
>
>



Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 02-28-2008, 08:03 PM
Dave Stone
 
Posts: n/a
Default Re: Text file import with DTS

Thanks for your reply, Chuck. I am assuming that it's essentially the
delimiter(s) that is giving the problem. When I define the row delimiter as
{LF}{LF} and hit 'Next', the Text File Properties dialog returns the message
about not finding the row delimiter within 8K. I've checked a dump of the
file, and there certainly is a {LF}{LF}sequence much sooner than that.

Because the individual fields of a record each have a separate line in the
input file, I would set the column delimiter to a single {LF}, but it's not
even giving me the chance to do that. So I reckon it just don't like my row
delimiter.

When I've loaded data before using DTS, the records have been transformed by
a Perl script into a one-long-line-per-record format, with commas as field
separators, and vertical bars as text qualifiers. The process is untidy
though, and I had hoped to find a bulk input route which would handle text
input files in one-column-per-input-line format.

I'm wondering if the similarity of my preferred format to the way XML
documents are normally laid out is a hint?

Dave

"Chuck Conover" <cconover@commspeed.net> wrote in message
news:1077124501.55653@news.commspeed.net...
> Dave,
> I'm not sure if your problem is related to the delimiter or the file
> format. If the problem is the delimiter and you can't get the file to

read
> in at all, then not sure I can help without an actual sample of the file

and
> some testing.
> If the problem is the file format, then I would suggest first reading
> your file into a temp table and then running a procedure to massage and

make
> any data corrections, and insert the massaged data into your production
> tables.
> I use this for all my DTS packages, even if they are very similar to

my
> production tables just so I can do any data checking first.
>
> Best regards,
> Chuck Conover
> www.TechnicalVideos.NET
>



Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
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
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 03:00 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com