Walk the string

0

Please login or register to vote for this query.

(click on this box to dismiss)

Gardening and Landscaping Meta

Q&A about the site for gardeners and landscapers

declare @S varchar(20)
set @S = '11$1,22$2,33$3,44$4,55$5'
set @S = Replace(@S, '$', '.');

while len(@S) > 0
begin
    declare @temp varchar(50) = ''
    set @temp = left(@S, charindex(',', @S+',')-1)
    print @temp
    select @temp = ParseName(@temp, 2)
    print @temp 
   ---- SELECT ParseName(@temp, 2) --returns Spiderman
    --SELECT ParseName(@temp, 1) --returns Marvel
    set @S = stuff(@S, 1, charindex(',', @S+','), '')
end

Enter Parameters

Options:
Switch sites:
loading Hold tight while we fetch your results