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
461 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
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 

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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Nowadays, some of developer are too much worried about data. Who is using data, who is updating it etc. etc. Because, data is more costlier in term of money and information. So security of data is focusing concern in days. Lets' understand the Au…
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…
Viewers will learn how the fundamental information of how to create a table.
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.

747 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now