Walk the string

0

Please login or register to vote for this query.

(click on this box to dismiss)

History of Science and Math Meta

Q&A about the site for people interested in the history and origins of science and mathematics

declare @S varchar(20)
declare @S1 varchar(200)
declare @S2 varchar(200)
set @S = 'hello/hello/hi/hello'

while len(@S) > 0
begin
  set @S1 = left(@S, charindex('/', @S+'/')-1)
  set @S2=@S1
  if @S1 <> @S2
  print @S1
  set @S = stuff(@S, 1, charindex('/', @S+'/'), '')
end

Enter Parameters

Options:
Switch to main site
loading Hold tight while we fetch your results