September 28, 2009 at 4:32 pm
I have 3 tables
Properties
Products
Property Product Junction
I want to dynamically crosstab with the properties as columns (Not explicitly defined) with the product name vertical with the id. then have the values in the middle. Just like an excel sheet. Is that possible?
September 29, 2009 at 1:19 am
You can do it by turning the Properties to a @Dec, e.g.
SELECT @columns = COALESCE(@columns + ',[' + cast(Invested as varchar) + ']',
'[' + cast(Invested as varchar)+ ']')
FROM #AA
GROUP BY Invested
and then using that as part of an Execute (@SQLquery). What's killing me is I get that working but in the Output, I can't find any way to turn, say, if the property and Product Name don't have a correlation into a 0 instead of NULL.
Heading home but if noone ays anything overnight, i'll explain what i have a bit better. ExpertsExchange has a good example for 'Dynamic Pivot Table' in the meantime.
September 29, 2009 at 7:10 am
You might want to have a look at the following article:
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply