• Steve Goram (10/28/2013)


    Hello,

    I have imported article data from a text file:

    Pos item

    ---------- --------------------

    1 tire

    NULL black

    NULL 50 $

    2 car jack

    NULL blue

    NULL 35 $

    3 screwdriver

    NULL red

    NULL 3 $

    and I want it like this:

    Pos item

    ---------- --------------------

    1 tire

    1 black

    1 50 $

    2 car jack

    2 blue

    2 35 $

    3 screwdriver

    3 red

    3 3 $

    Can anyone help ?

    Thanks

    Steve

    For the data you posted above, please post what the raw data in your import file looks like because this is definitely the wrong way to do it. Once you post that data from the file, then I'll be able to show you how to greatly simplify this process and properly normalize the data all at the same time.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)