• Brandie Tarvin (5/13/2013)


    wolfkillj (5/13/2013)


    I couldn't use your sample data because the text file formatting seemed to be inconsistent from line to line

    Exactly. If you check my first post, you'll see where I made that point. That's why we import all rows into a single column in the staging table to begin with.

    I need a solution that addresses my current setup, including the inconsistent data.

    I went back and re-read your OP. If I understand you correctly, rows of different types (vendor and detail) have different data and so can't be parsed into the same set of columns. But you CAN reliably parse out the record ID value, leaving the rest of the row in a single column, and you CAN parse each type of row into its particular column set, right? If so, you can use the code I posted as a basis for identifying the rows that belong together (e.g., a record ID = 2 row with its associated record ID = 3 row(s)) and assigning them a single identifying number. Then, you can split the rows out into the different tables based on their record ID values (vendors and detail), using that identifying number as a foreign key. Does that get you where you need to go, or am I overlooking something.

    I didn't study WayneS's solution in detail, but it looks like he took a very similar approach to keeping together the groups of rows that belong together.

    Jason Wolfkill