copy heirarchical data

  • wats the best way to copy heirarchical data in stored proc , for example there are 3 tables parent, child, grandchildren . so wat we need to do is copy first row from parent and all the child rows for that row and further rows in grandchildren .

    we will be using vb.net and ado.net ,so thought of following options

    • get all data in dataset (wont work for very large data)
    • use cursor (wudnt it be very slow??)

    any other suggestions?

     wat will be best solution from perfomance point of view ???

    thnx

    amrita

     

  • Can you post the table definition, some sample data and the expected results?

  • sure lets say there are 3 tables (actually table will be decided at the runtime , nyways)

    country , state , city in the source , they can be in different database servers and three tables in destination also , so wat we need to do is

    first copy first country (India )

    now copy all the states for the country india

    now copy all the cities which are child of above states

    reason being no orphaned child id copied

    hope that clarify

    thnx

    amrita

  • Not really. The fact that this will be dynamic makes generating this code a big pain. Can't this be static?

    Can you provide the actual table script, Sample data and expected output from the queries?

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

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