Hi there:
Here is the background:
Order Line Item contains the lowest level of details
and each Item contains Product Option and option value.
For example : For a Photobook Order Item
It can have up to 10 product options as follows:
Photo Book Cover Material
Photo Book Size
Photo Book Type
Photo Book Min # Of Pages
Photo Book Cover Colour
Dust Jacket Allowed
Photo book cover type Solid/Soft
Photo Book Skin Cover look of MiniBook/PhotoCover
Photo Book Max # Of Pages
Photo Book Page Increment
Here is the table orderItemOption that contains Order Line Item and its associated product Options
CREATE TABLE [dbo].[orderItemOption](
[ID] [int] IDENTITY(1,1) NOT NULL,
[OI_ID] [int] NULL, -- Order Item
[RPO_ID] [int] NULL, -- Production Option
[RPOV_ID] [int] NULL -- Production Option Value
) ON [PRIMARY]
GO
Sample datasets below:
IDOI_ID RPO_IDRPOV_ID
11378 1010944756
21378 1011044757
31378 10115NULL
41378 1011844769
51379 1010944756
61379 1011044757
71379 10115NULL
81379 1011844769
91380 1010944756
101380 1011044757
111380 10115NULL
121380 1011844769
131381 1010944756
141381 1011044757
151381 10115NULL
161381 1011844769
......
Here is what I want to do:
I want to create a product dimension and create a ProductAlternateKey which will be
purely based on the combination of all RPO_ID and RPOV_ID for each OI_ID. I am gonna create a HASH value (Use HASHBYTE to minimize collision) based on the combination
and this HASH value (convert to BIGINT) will become the BusinessKey for this product dimension.
The challeng here is to construct the Product Dimension table as I need to pivot the table dbo.orderItemOption so that each line contains one Order Item and
all its associated option ID and option Value. Since some order item may have up to 10 options, I need to create at least 20 new columns like
RPO_ID_1, RPOV_ID_1, RPO_ID_2, RPOV_ID_2, RPO_ID_3, RPOV_ID_3 which indicate option 1, option value 1, option 2, option value 2 and option 3 , optionvalue 3...
Does anyone here have encountered the similiar problem before?
I'd appreciate if you would share your experience.
Thanks
Hui
--Currently using Reporting Service 2000; Visual Studio .NET 2003; Visual Source Safe SSIS 2008 SSAS 2008, SVN --