declare @t table (name varchar(10), items varchar(10))
insert @t
select 'AAA', '1' union all
select 'BBB', '2,' union all
select 'CCC', '3'
select t.name
,'1' + substring(items, 2, 1000) as Items
from @t t
join master..spt_values n
on n.type = 'P'
and n.number < convert(int, left(items,1))
No comments:
Post a Comment