Help needed

  • please help me

    below is the source table

    new proj id old proj id

    1084d 1084/

    1084e 1084a

    1084f 1084b

    1077a 1077/

    1077b 1077a

    2134a 2134/

    2134b 2134a

    and the desired target is:

    new proj id old proj id

    1084d 1084/

    1084e 1084a

    1084f 1084b

    1077b 1077/

    1077b 1077a

    1077b 1077b

    2134b 2134/

    2134b 2134a

    2134b 2134b

  • Please provide table def and sample data in a ready to use format together with your expected result and what you've tried so far. For details on how to post sample data please see the first link in my signature.

    A short description of the business case (What are you trying to do?) would also be helpful.



    Lutz
    A pessimist is an optimist with experience.

    How to get fast answers to your question[/url]
    How to post performance related questions[/url]
    Links for Tally Table [/url] , Cross Tabs [/url] and Dynamic Cross Tabs [/url], Delimited Split Function[/url]

  • the table have new project ids and old project id as in like proj id 1A is transfered to proj id 1b also the proj id 1b is transferd to 1C and in few cases where in proj id 2A is transferd to 3B and few cases where in proj id 2A is transferd to 2D

    the source table will look like

    new proj id old proj id

    1077A 1077/

    1077B 1077A

    1077C 1077B---(in this case 1077/ is got transfered multiple times first 1077A then 1077B..)

    1084D 1084/

    1084E 1084A------(in this eg 1084A is one time transfered to 1084E unlike 1077 case)

    1084F 1084B

    2034A 3034/

    desired target table should be like

    new proj id old proj id

    1077C 1077/

    1077C 1077A

    1077C 1077B

    1077C 1077C

    1084D 1084/

    1084E 1084A

    1084F 1084B

    2034A 3034/

    please let me know if it is not clear

  • There's nothing there to guarantee the order of the rows and that's one of the many reasons why Lutz requested that you post the data according to the article he cited.

    --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)

  • Actually, this is a duplicate post which has already been answered at the following...

    http://www.sqlservercentral.com/Forums/Topic941870-392-1.aspx

    --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)

  • Hi Jeff its my mistake, in the previous post initially i hav posted with only one business case but later when i got deep into the case, got to know there are 2 other cases where in the solution might not get applied so thought of reposting the scenario again clearly in new post

    apologize for any unintentional act....

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

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