У меня есть что-то как
, полученное при запуске сценария
declare @t table(id int identity, bucket varchar(200), startinventory int, nocontact int)
INSERT INTO @t
SELECT 'bucket1',1234,72500 UNION ALL
SELECT 'bucket2',6784,60500 UNION ALL
SELECT 'bucket3',678,52000 UNION ALL
SELECT 'bucket4',234,45000
select * from @t
Поиск преобразования, выход которого будет

Нынешний сценарий, который выполняет преобразование, представлен ниже
select 'startinventory' as Activities,
bucket1=(select startinventory from @t where id=1),
bucket2=(select startinventory from @t where id=2),
bucket3=(select startinventory from @t where id=3),
bucket4=(select startinventory from @t where id=4) union all
select 'nocontact',
(select nocontact from @t where id=1),
(select nocontact from @t where id=2),
(select nocontact from @t where id=3),
(select nocontact from @t where id=4)
Есть ли лучший способ написать сценарий?