U-Turn (Going the other way)

So, here's a way to get back a delimited list of items from a table. In other words, concatenate values into one column (that you can then take together to pass to my parse table function).

--Setup a sample data to demonstrate the concept
declare @Table1 as Table (id int, Item varchar(100))
insert into @Table1 values (1, 'a')
insert into @Table1 values (1, 'b')
insert into @Table1 values (2, 'c')
-- show the table data
select * from @Table1

--retrieve the data from @Table1 as a concatinated list
Select distinct id, (
Select upper(Item)+' ' as [text()] from @Table1 S 
where id = T1.id 
for xml path('')) Items  from @Table1 T1


Popular posts from this blog

KnockoutJS, WebAPI, and TypeScript

Database Projects, SQL Unit Tests, and TeamCity