I don't have an elegant solution for this problem; once when I had to generate a pipe-delimited string, I solved it the quick and dirty way (which I am not proud of), but here it is:declare @test table (col1 varchar(100));insert into @test values ('Johnson & Johnson');insert into @test values ('A & P Markets');select replace(( select col1 as [text()], '|' as [text()] from @test order by col1 for xml path('')),'&_amp_;','&');
In the above, the &_amp_; should not really have the underscores. If I try to post it without those underscores, it doesn't post propertly. I guess sqlteam website and Snitz also use XML :-)Of course, you will need to do replace for the other four or five special characters as well if your data could have any of those. Toldya, it's quick and dirty.