canuckconsulting
asked on
SSiS How to transform multiple rows into different columns of one row
I have one DB with a table defined as follows:
ProductsInStock1
ProductID
Size
Qty
If we had product 1 available in small medium and large the three records would look like:
1 | Small | 92
1 | Medium | 33
1 | Large | 30
I need to transform this using SSIS to a table defined as:
ProductsInStock2
ProductID
QtySmall
QtyMedium
QtyLarge
QtyExtraLarge
For the same product above I would want a single row as follows:
1 | 92 | 33 | 30 | NULL
How can I transform the data as required?
ProductsInStock1
ProductID
Size
Qty
If we had product 1 available in small medium and large the three records would look like:
1 | Small | 92
1 | Medium | 33
1 | Large | 30
I need to transform this using SSIS to a table defined as:
ProductsInStock2
ProductID
QtySmall
QtyMedium
QtyLarge
QtyExtraLarge
For the same product above I would want a single row as follows:
1 | 92 | 33 | 30 | NULL
How can I transform the data as required?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Perfect...thanks!
Wouldn't this be best done as a pivot query?
Open in new window
HTH
David