declare @str varchar(1000)set @str=''select @str=@str+cast(t as varchar)from (select case when count(distinct a)>1 then 'a,' else '' end as t from testunionselect case when count(distinct b)>1 then 'b,' else '' end from test union select case when count(distinct c)>1 then 'c,' else '' end from test unio...