Appending data from one flat file to another

  • Hello everybody,

    I need to copy data from one flat file to another through a DTS package.

    I tried creating DTS packages manually and through a DTS wizard.

    I'm changing a 'Column Mappings' to 'Append Rows to Destination Table' in a 'Transform' option.

    Every time I'm running either one of these packages my source file overwrites the destination one.

    Can anybody help?

    Thank you in advance.

    Alex

  • This was removed by the editor as SPAM

  • If I understand you properly, you are having a problem where the destination text file is cleared out prior to data being written to it. I have never tried writing to a text file through DTS, so I'm not sure how to handle it in DTS.

    There is a method you could try that would be outside of DTS. You could output your data to a second destination file, while leaving the original file intact. The final DTS task would be to concatenate the second destination file to the end of the original target file. It's not very elegant, but it would work.

    This solution does not really solve the problem of how to accomplish this in DTS. We use Informatica as an ETL tool and this is one way to do the same type of thing within that tool.

    Please respond with more detail of what you are trying to accomplish and maybe we can offer better suggestions appropriate to your task.

  • Hello guys,

    Thank you for your reply.

    Since I published this topic on the 3d of October & today is October the 29th I could not wait so long and found the answer myself.

    I didn't come with it before, because having no replies I was pretty much sure that nobody is interested in this topic.

    Plus, asking and answering to your own questions doesn't make a really good sense.

    Anywhere, since I got a response I'm publishing a short piece of code solving this problem:

    Set f1 = fso.OpenTextFile(1stFile, ForAppending, True)

    f1.Write AppendFiles(2ndFile)

    f1.Write AppendFiles(3rdFile)

    Function AppendFiles (sFile)

    Set f2 = fso.OpenTextFile(sFile, ForReading, True)

    AppendFiles = f2.ReadAll

    End Function

    Thank you,

    Alex

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply