Need help with a Export

  • DTS SQL 2000

    A view is used to create the .dat file.

    I need to insert a trailer record as at the end of the file.

    Trailer record char(36)

    Record Count char(7)

    Date

    filler space(25)

    Example:

    TRAILER RECORD DATA 737 MMDDYYYY

    Looking for help!!!:unsure:

  • Hi Debra,

    The technique that I have seen is to write the trailer data to a separate file and concatenate the files at the DOS level. You could also use the FileSystemObject in an ActiveXScript Task to combine the view file and the trailer file.

    Norman Kelm

    DTS Package Search

    http://www.dtspackagesearch.com/

  • Hi Norman,

    I do not have the knowledge to write a ActiveXScript Task.

    Any help would be greatly appreciated!;)

  • Great examples here: http://www.sqldts.com/292.aspx

    Here is code that opens a file for append

    strFile = "c:\output.txt" ' e.g. c:\output.txt

    ' ------ END CONFIGURATION ---------

    const ForAppending = 8

    set objFSO = CreateObject("Scripting.FileSystemObject")

    set objFile = objFSO.OpenTextFile(strFile, ForAppending, True)

    objFile.WriteLine("Script completed: " & Now)

    objFile.Close

    Norman Kelm

    DTS Package Search

    http://www.dtspackagesearch.com/

  • Thanks, Norman

    objFile.WriteLine("How do I reference the trailer row here?")

    strFile = "c:\output.txt" ' e.g. c:\output.txt

    ' ------ END CONFIGURATION ---------

    const ForAppending = 8

    set objFSO = CreateObject("Scripting.FileSystemObject")

    set objFile = objFSO.OpenTextFile(strFile, ForAppending, True)

    objFile.WriteLine("Script completed: " & Now)

    objFile.Close

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

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