[Solved] T-SQL (Un)Pivot Table
I usually use dynamic sql. Something like this create table #T ( ID int, aText1 varchar(4), aText2 varchar(4), aInt1 int, aInt2 int ) insert into #T select 1, ‘ABC1’, ‘XYZ1’, 2, 20 union select 2, ‘ABC1’, ‘XYZ2’, 3, 25 union select 3, ‘ABC2’, ‘XYZ2’, 1, 30 union select 4, ‘ABC2’, ‘XYZ1’, 4, 35 declare @sql … Read more