Not sure what exactly your question is but maybe this will help:--starting pointcreate table #t (Customer int, Treas varchar(10))insert #tselect 1010, 'Merch' union allselect 1010, 'Price' union allselect 1020, 'Merch' union allselect 1030, 'Promo'go--add the columnalter table #t add period int nullgo--update the data for period=1update #t set period = 1--generate the remaining periods (using a table that has a bunch of numbers in it)insert #t (customer, Treas, Period)select customer ,Treas ,numberfrom #t tcross join master..spt_values vwhere v.type = 'P'and v.number between 2 and 12select * from #tdrop table #t
Be One with the OptimizerTG