Mathimatical Select Statement.

  • HI ,,

    i have two different Tables, One is used to store data, and second is used to show the relationship that the data is stored in the first table...

    TABLE1

    DocIDEmailQty_AtchAttch_Doc

    1A00

    2B1B1

    Now Attachement should have DocID So

    3B100

    4C3C1,C2,C3

    Now Attachement should have DocID So

    5C11C12

    Now Attachement should have DocID So

    6C1200

    7C200

    8C300

    in second table i have saved the relationship which is parent and which is child .. like this

    ParentDocID ChildDocID

    2 3

    4 5

    5 6

    4 7

    4 8

    what i need is to save the DocID into another table in such a formate that if the documents are interrelated to each other should get single ID.. like this by a Store procedures..

    Newly_DocIDDocID

    1 1

    2 2

    2 3

    3 4

    3 5

    3 6

    3 7

    3 8

  • That's what is called "expanding a hierarchy". Microsoft has posted an example on how to do just that. It's here:

    http://msdn2.microsoft.com/en-us/library/aa172799(SQL.80).aspx

    ----------------------------------------------------------------------------------
    Your lack of planning does not constitute an emergency on my part...unless you're my manager...or a director and above...or a really loud-spoken end-user..All right - what was my emergency again?

Viewing 2 posts - 1 through 1 (of 1 total)

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