Append data to Flat file from SQL table

  • Can anyone help

    I've used DataPumpTransformCopy Object to copy data from table to flat file.Every time when the object perform copying, the existing flat file will be entirely overwritten. I would like to just append the data not overwrite the existing data inside the flat file. I've tried DataPumpTransformWriteFile Object but encountered errors.

    Please guide

    Thanks

  • Hi Ken,

    To make this work... everytime you fire DTS pkg you need to create a dinamic new flat file with different name and at the end of the pkg you can append to the main flat file with simple dos copy newFile.txt mainfile.txt.

    Example in how to change the flat file.

    Function Main()

    Dim oConn, sFilename

    ' Filename format - exyymmdd.log

    sFilename = "ex" & Right(Year(Now()), 2)

    If Month(Now()) < 10 Then sFilename = sFilename & "0" & _

    Month(Now()) Else sFilename = sFilename & Month(Now())

    If Day(Now()) < 10 Then sFilename = sFilename & _

    "0" & Day(Now()) Else sFilename = sFilename & Day(Now())

    sFilename = DTSGlobalVariables("LogFilePath").Value & _

    sFilename & ".log"

    Set oConn = DTSGlobalVariables.Parent.Connections("Text File (Source)")

    oConn.DataSource = sFilename

    Set oConn = Nothing

    Main = DTSTaskExecResult_Success

    End Function

    JFB

Viewing 2 posts - 1 through 1 (of 1 total)

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