.net - SSIS - Importing variable format text files -


By "variable format" I mean that each line in the text file starts with a single character code, which represents the record type, and

  0ThisIsAFileHeader 2IIsABatchHeader 4ThisIsDetailData 4ThisIsDetailData 6ThisIsamatchingBatchFooter 8ThisIsamatchingFileFooter  

0/8 header / trailer record (each of their formats), 2/6 sub-headers / sub-trailer records (each of these formats also) and 4 indicates actual data or details records.

SQL Server 2008, Visual Studio .NET 2008. Is a custom script work the only way to import this data? Given this, does anyone tell me about the resource that talks about doing so? Importing a fixed-width text file is very straightforward, but I'm not sure when the script will fall into the work control flow and how the data will be used in subsequent steps.

It can be done within SSIS, although you will have to jump through some hoops Here's a way:

  • The source file should be set as 2 columns, first character, and the rest of the string.
  • On the first character to break conditional split action based rows into separate workflows.
  • To take the action of data conversion to the second column and divide it into the appropriate fields, it should be done separately for each type of line and the appropriate conditional partition line.
  • Destination must be configured to handle / handle data properly for each conditional branch.

To start linking items together further ETL work is required, I will import the files into temp tables or permanent staging areas and make more changes before final results I will fulfill

The real problem is that the data is related and how will you keep this relationship /. I think that if I had to throw it together then I use a script component in the data flow, which increments a counter every time in a top record, and the output is in the stream. Thus, each record contains an identity number which can be used to relate later.

It is a bit complicated but the problem can be worked around.


Comments

Popular posts from this blog

MySql variables and php -

url rewriting - How to implement the returnurl like SO in PHP? -

Which Python client library should I use for CouchdB? -