--Working table: when individual items are inserted, --trigger concatenates them to a list create table Tstr ( s varchar(8000) ) go create trigger Tstr_ins on Tstr for insert as if (select count(*) from inserted) % 2 = 0 begin truncate table Tstr insert into Tstr select max(I1.s)+', '+I2.s from inserted I1 join inserted I2 on I1.s < I2.s group by I2.s having count(I1.s)%2=1 end else if (select count(*) from inserted) > 1 begin truncate table Tstr insert into Tstr select max(I1.s)+', '+I2.s from inserted I1 join inserted I2 on I1.s < I2.s group by I2.s having count(I1.s)%2=1 union all select max(s) from inserted end go --example 1 insert into Tstr select distinct top 21 customerid from northwind..orders select s from Tstr truncate table Tstr --example 2 insert into Tstr select au_id from pubs..authors select s from Tstr truncate table Tstr go drop table Tstr