• sarwaanmca (12/28/2012)


    Hi,

    I Have Table Data For The Following Stucture..

    CREATE TABLE [dbo].[xmldata](

    [FirstName] [varchar](110) NULL,

    [LastName] [varchar](210) NULL,

    [Email] [varchar](110) NULL,

    [Phone] [varchar](110) NULL,

    [Position] [varchar](110) NULL,

    [Branch] [varchar](110) NULL,

    [Address] [varchar](110) NULL

    ) ON [PRIMARY]

    GO

    Hmmm.... on my way to work so I can't do it right now but there might be a way to do this. We know that the Position column doesn't contain anything that supports the required relationship calculations. However, sarwaanmca has laid out what the relationships are in a post further above. Perhaps the answer is to create a table with the postion name (from the position column), an "ID", a "ParentID", and a "Level" column to impart the necessary relationship information to the data.

    The fly in the ointment, of course, will be the non-unique leaf levels.

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