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
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
468 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
  • 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
VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

 

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Introduction In my previous article (http://www.experts-exchange.com/Microsoft/Development/MS-SQL-Server/SSIS/A_9150-Loading-XML-Using-SSIS.html) I showed you how the XML Source component can be used to load XML files into a SQL Server database, us…
Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

792 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