I would like to create a new table from the results the of an unpivot ,is possible to use the results from an unpivot to create a new table ?
Like for example can you add something like this Insert into newtable
Begin tRAN
select 2 AS Category_ID,
Techcentre,
kpi,
Quarter,
Result
From [Technology_Centre_New_Data_Import]
UNPIVOT
(
Result
for Quarter IN (Q1_15,Q2_15,Q3_15,Q4_15,Q1_16,Q2_16,Q3_16,Q4_16,Q1_17,Q2_17,Q3_17,Q4_17,Target_15,Target_16,Target_17)
)unpvt;
Just use select into
:
select 2 AS Category_ID, Techcentre, kpi, Quarter, Result
into newTable
From [Technology_Centre_New_Data_Import]
unpivot (Result for Quarter in (Q1_15, Q2_15, Q3_15, Q4_15, Q1_16, Q2_16, Q3_16, Q4_16, Q1_17, Q2_17, Q3_17, Q4_17, Target_15, Target_16, Target_17)
) unpvt;