i am fallowing this link
http://sqljunkies.com/Article/705F07C3-69FE-4CAF-8CF8-CADBF145F372.scuk
last 15 th i am unable to understatnd the value to set tht pivotkey value for the output columns
INPUT COLUMNS LEGEND ID
CUSTOMER 861
PRODUCT 864
ID
OUPUT COLUMNS SOUREC COLUMN PIVOT KEY VALUE
CUSTOMER 861 ?
HamQty 864 ?
MILKQTY 864 ?
BEERQTY 864 ?
BREADQTY 864 ?
CHESSQTY 864 ?
HAMQTY CANNOT MAPPED WITH PIVOTKEY VALUE ERROR I AM GETTING
PLEASE HELP ME
You have run into a special degenerate case for the Pivot transform.
You do not have a pivot value. You simply have customers that purchase products, but you have no measurement such as “quantity” associated with the purchase. The existence of the row acts as a measure.
So what is the pivot value? There is not one.
You can set the lineage ID for the output columns to “-1” this is a special case use. When you do so, the value “TRUE” will be put into columns that have matching existing rows in the source.
This also means that your output columns need to be BOOLEAN typed so they can hold the value TRUE. (or NULL if not matched)
to use your example:
Input data
Customer(861) Product (864)
(the set key) (the pivot key)
-
JohnCheese
JohnBread
BillHam
Turns into
Customer CheeseExists BreadExists HamExists BeerExists
-- -- -
JohnTRUETRUENULL NULL
BillNULLNULLTRUENULL
Your output columns would be:
NameType SourceColumn PivotKeyValue
-- -
Customerchar861
CheeseExists VT_BOOL-1Cheese
BreadExistsVT_BOOL-1Bread
HamExistsVT_BOOL-1Ham
BeerExistsVT_BOOL-1Beer
No comments:
Post a Comment