• dwain.c (8/27/2012)


    However you have not provided DDL for your tables, nor INSERTs (setups) for your sample data.

    Remember we're all volunteers here. 🙂

    Ok Volunteers... here's your script as promised... I know, I'm slow...

    Create table Doc (

    DocNum nvarchar(15) NOT NULL

    );

    Insert into Doc (DocNum)

    Values ('1');

    ------------------------------

    Create Table GR (

    DocNum nvarchar(15) NOT NULL,

    GR nvarchar(15) NOT NULL,

    Seq intNOT NULL

    )

    Insert into GR (DocNum, GR, Seq) Values (1,'A',1)

    Insert into GR (DocNum, GR, Seq) Values (1,'B',2)

    --------------------------------

    Create Table GE (

    DocNum nvarchar(15) NOT NULL,

    GE nvarchar(15) NOT NULL,

    Seq intNOT NULL

    )

    Insert into GE (DocNum, GE, Seq) Values (1,'A',1)

    Insert into GE (DocNum, GE, Seq) Values (1,'B',2)

    Insert into GE (DocNum, GE, Seq) Values (1,'C',3)

    --------------------------------------------------

    Create Table Ref (

    DocNum nvarchar(15) NOT NULL,

    Ref nvarchar(15) NOT NULL,

    Seq intNOT NULL

    )

    Insert into Ref (DocNum, Ref, Seq) Values (1,'A',1)

    Insert into Ref (DocNum, Ref, Seq) Values (1,'B',2)

    Insert into Ref (DocNum, Ref, Seq) Values (1,'C',3)

    Insert into Ref (DocNum, Ref, Seq) Values (1,'D',4)

    Insert into Ref (DocNum, Ref, Seq) Values (1,'E',5)

    select * from Doc

    select * from GR

    Select * from GE

    select * from Ref

    OH GREAT WIZARDS OF UBER-CODE! HEAR MY SCHREAKING AND BID ME GOOD TIDINGS!!!