Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Import/Export (DTS) and Replication (2000)
 Dropping last line of import

Author  Topic 

bsj
Starting Member

2 Posts

Posted - 2004-07-26 : 04:49:11

I am trying to import a semicolon separated text file. (this in itself is not an issue). My problem is that the last line of the text file is not imported.
The file is imported correctly if I open the file then add a carriage return at the end of the file. What I am trying to ask is there a way around this without manually editing the text file??

ditch
Master Smack Fu Yak Hacker

1466 Posts

Posted - 2004-07-26 : 06:03:29
What process creates the text file that you want to import?

It should be corrected in the system that creates that file.


Duane.
Go to Top of Page

bsj
Starting Member

2 Posts

Posted - 2004-07-26 : 06:08:01
Unfortunatly the file is sent to me by an external company which I have no control over!!!!
Go to Top of Page

ditch
Master Smack Fu Yak Hacker

1466 Posts

Posted - 2004-07-26 : 06:26:46
OK,
I'll take a stab in the dark.

1.) Create a file which contains just one carriage return in it (In notepad)
2.) Save it to a name carriagereturn.txt
3.) The first step of your import package must now be a transact sql task which contains this one statement:

xp_cmdshell 'type carraigereturn.txt >> yourimportfilename.txt'

This will append a carriage return to your import file.

Hope this works.


Duane.
Go to Top of Page
   

- Advertisement -