Control row in CSV file, SSIS script task?

  • Hi All,

    I have a comma delimited CSV file in the following format.

    Field1; field2; field3; field4; field5;

    Field1; field2; field3; field4; field5;

    Field1; field2; field3; field4; field5;

    Etc; etc; etc; etc; etc;

    FILE END ROWCOUNT=4;

    I am loading this data into SSIS SQL Server table, using a flat file connect. Currently the data follow task works ok, but the final row is not loaded. I would like to load this row into a separate ‘Control table’. I presume the best way to achieve this would be using a script task and creating two files. One containing the data and one containing the control row before loading. Can anyone help me with the code to do this?

    Many Thanks in advance.

    Regards,

    Chris

  • [font="Comic Sans MS"]

    You may alternatively use conditional split - check this out

    http://filedb.experts-exchange.com/incoming/2009/02_w06/102596/Working-with-Flat-Files-in-SSIS.pdf

    [/font]

    [font="Comic Sans MS"]--
    Sabya[/font]

  • Hi sabyasm,

    This is a great idea that I really like of using the Conditional Split. But unfortently it send all the data to the data destination object when I tried using the following syntax, within the conditional split:

    FINDSTRING(VISION_GORR_DATA,"FILE END ROWCOUNT",1) == 1

    Chris

  • [font="Comic Sans MS"]

    That's strange - it should work.

    Can you use data viewer and see if your variable vision_gorr_data is coming as row-by-row?

    Will check myself (unfortunately no time right now) and will get back. Meantime can you go through the reference and see if you are doing something differently (other than naming etc)... check if you are using right delimeter/text qualifier ..

    [/font]

    [font="Comic Sans MS"]--
    Sabya[/font]

  • Thanks sabyasm.

    I have found the problem using the data reader.

    The source flat file connection Row Delimiter had to be changed, as the source file had been generated on a Unix enviroment.

    Thanks Again for your assistance. Really appreciate it.

    Regards,

    Chris

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

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