A little SQL trick:
-- Recordset a CSL
select REPLACE(REPLACE(REPLACE((SELECT rtrim(CityID) as AFROM BaseCityORDER BY CityIDFOR xml PATH ('')),'</A><A>',','),'</A>',''),'<A>','')
-- CSL a Recordset
declare @list varchar(1000)
set @list = 'Juan,Pedro,Alberto'
declare @x xml
set @x = '<A>' + REPLACE(@list,',','</A><A>') + '</A>'
select x.item.value('.','varchar(20)') as nombre
from @x.nodes('//A') as x(item)
No comments:
Post a Comment