Solved

Need to add an EOF marker to a Tab delimted text file being exported from SQL using DTS

Posted on 2008-10-08
8
471 Views
Last Modified: 2013-11-30
I am VERY new to SQL and DTS.  I have created a SQL statement that selects the data I need and I have figured out how to use the DTS Export wizard to create a tab delimited file.  However, I need to add an EOF marker to the end of the destination text file.  I also need to name the destinatiion file dynamically based on the date.  Can you help me with some very detailed instructions on how to do this?

Thanks, DixieBP
0
Comment
Question by:dixiebp
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
8 Comments
 
LVL 75

Expert Comment

by:Anthony Perkins
ID: 22675584
>>However, I need to add an EOF marker to the end of the destination text file. <<
Any reason why? And if so define EOF in ASCII

>>I also need to name the destinatiion file dynamically based on the date. <<
See here:
How can I change the filename for a text file connection?
http://www.sqldts.com/200.aspx
0
 

Author Comment

by:dixiebp
ID: 22677813
Thank you.....the file naming now works.  Do you know of a way too add an EOF marker after the last line of data in the text file?
0
 
LVL 75

Expert Comment

by:Anthony Perkins
ID: 22683558
>>Do you know of a way too add an EOF marker after the last line of data in the text file?<<
Again, any reason you have to do that?  An EOF character is very rarely needed and has not been needed since mid-80's. If you still want to do it, than you will have to define what you mean by EOF in ASCII.  CHAR(26) perhaps?
0
Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

 

Author Comment

by:dixiebp
ID: 22687036
We are sending the file to a company that uploads it into their system.  They require some type of EOF marker to they know they have received a complete file.  It can literally be the text "EOF" after the last line of data in the file.
0
 
LVL 75

Accepted Solution

by:
Anthony Perkins earned 50 total points
ID: 22691861
Than you will have a couple of options:
1. Open the file using the FileSystemObject and write it out, when you get to the end write out "EOF".
2. Change your query that exports the data to a UNION query and add SELECT "EOF" at the end.  This second option is simpler, but may be dependent on the number of columns and column delimiter.
0
 
LVL 51

Assisted Solution

by:Mark Wills
Mark Wills earned 50 total points
ID: 22694101
Or even at the end of your export, run a command or batch that simply does a copy / concatenate

at the dos prompt, try this :

1) as a one time process, create an EOF file:
echo EOF > eof.txt

2) then as a normal part of your process, run a command / batch to:

copy myexportedtable.txt+eof.txt newexportedfilewitheof.txt

0

Featured Post

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
This article shows gives you an overview on SQL Server 2016 row level security. You will also get to know the usages of row-level-security and how it works
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.
Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.

724 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question