SSIS create text file and add text

  • Hello everyone...

    I have an SSIS package that copies a template file before it extracts data from the database. Somehow my template file keeps getting deleted from the file system.

    I would like to add logic to my package that will create the output file and add one line of text to the file each time the package runs and does the extract. This will prevent the file being missing from disk and causing the package to fail.

    Does anyone have any hints on what components I need to use to do this?

    Any help would be great.

    Thanks

  • Steps:

    (1) create one folder (sourse) under that you are created .csv file as your text header only...

    (2) create another folder(destination) under that create same above mention file in destination also.

    (3) normal craete ssis package flat file destination is map to destination folder related file.

    is ssis package

    step 1: to take one file system task to remove destination folder file.

    step 2: to take another file system task to copy file from sourse

    folder to destination folder.

    step :data fole task for loading data from sql server to flat file

    destination.

    (4) to set delay validation =true...

  • That is our current configuration. I have a master file that is copied. Somehow the master file gets deleted and we cannot identify what is deleting the file. So that is why I want to create the file from SSIS every run and put the text in it that needs to be there.

  • I have several SSIS packages that do this. As far as I know, the text file is created automatically if it does not exist.

    If you want that first row to be the column rows, then in your connection manager, just make sure you have checked the box for "Column names in the first data row". If you want any text before the first row (or column headers), then in the Data Flow task, double-click on your Flat File Destination and add whatever you want in the big text box titled "Header". Might be a good idea as well to check the box for "Overwrite data in the file".

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

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