Home Forums SQL Server 7,2000 T-SQL implement parent and child in build of materials “ RE: implement parent and child in build of materials “

  • Hi folks,

    I’m working away at this end and would like to ask if I’ve followed you correctly regarding:

    1) the number of primary keys for each table

    2) the relationships between them.

    So, I’ve listed the tables, with my interpretation of them.

    tblProduct (single primary key)

    productId INT NOT NULL IDENTITY(1,1),

    productDesc VARCHAR(150) NOT NULL

    tblBom (single primary key)

    bomId INT NOT NULL IDENTITY(1,1),

    bomName VARCHAR(150) NOT NULL

    I think, so far so good 🙂

    Now:

    tblBomProduct (composite primary key?)

    bomId INT NOT NULL REFERENCES(tblBom.bomId)

    productId INT NOT NULL REFERENCES(tblproduct. productId)

    tblProductDependent (composite primary key?)

    productId INT NOT NULL REFERENCES(tblproduct. productId)

    dependentId INT NOT NULL

    I am not sure how to relate the “dependentId” to

    TblProduct.productId…

    1) should I relate it? (I was getting errors when I tried to)

    2) should both these fields compose the primary key for this table ?

    tblBomDetail (composite primary key?)

    bomId INT NOT NULL REFERENCES(tblBom.bomId),

    productId INT NOT NULL REFERENCES(tblproduct. productId)

    Now, using the car analogy, would the productId that represents the car,(ie, the highest-level product )be contained in tblBomDetail?

    Sorry if all of this is a bit dis-jointed..

    What you’re actualy seeing is the contents of what is left of my dodgy brain...

    Cheers,

    yogiberr