• I would create a view if the number of AttributeId was 16 or less in total.

    But, from you post I would guess higher.

    If the total number of AttributeId per product (ProductId, AttributeId pairs) is small enough 16 or less I might still try a view, but not sure how to code it.

    See USE MASTER; EXEC sp_helptext 'INFORMATION_SCHEMA.KEY_COLUMN_USAGE'

    for a idea of how I would try to do it, but it would be more complex than that.

    I can't figure out a way to do it without using a proc and a temp table right now.

    Some sample data and create code would make it easier to help.

    Tim S

    PS

    CREATE TABLE #tmp ( rowkey INT IDENTITY, AttributeId)

    INSERT INTO #tmp ( AttributeId ) SELECT AttributeId FROM ?? WHERE ProductId = ??

    Then use the tmp table above in a SELECT like in the KEY_COLUMN_USAGE view.