Get tables list based on Parent/Child relation

  • Is there a way to list (using SQL server 2005) to list hierarchy of

    table parent & child relationship:

    1) A list that shows which table should be deleted first,second,third...

    2) A list that shows which table should loaded first, second,third...

    Thanks.

  • Hi,

    I have two queries, say for example

    Select distinct 0 parent_id, ROW_NUMBER() OVER(

    ORDER BY Column2_Desc ) AS 'ID', Column2_Desc

    From table1

    Union

    Select distinct 0 parent_id, ROW_NUMBER() OVER(

    ORDER BY Column2_Desc ) AS 'ID', Column2_Desc

    From table2

    I don’t have relationship between two tables.But I want to frame parent child relationship between these two so that my resultset should like

    Parent_ididColumn2_Desc

    01ABC

    02XYZ

    03ASDF

    14VGTY

    25DFT

    I don’t want to use stored procedure.

    Kindly Help Me Out

  • Im not clear on your issue , but in any case i would start a new thread. Most people will ignore old threads.



    Clear Sky SQL
    My Blog[/url]

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

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