View Single Post
  #7 (permalink)  
Old 09-30-09, 12:40
m.timoney m.timoney is offline
Registered User
 
Join Date: Oct 2002
Location: Leicester - UK
Posts: 819
actually that example is pretty hideous

i'd probably go for something like

Code:
create function ConvertStringToList
(
@string varchar(1000),
@delimiter char
)
returns @rtn table (VAL int)
as
begin

	declare @index int
	set @index = CHARINDEX(@delimiter, @string)


	IF @index >0
	BEGIN
		set @rtn = ConvertStringToList(SUBSTRING(@string, @index + 1, LEN(@string) - @index),@delimiter,@partiallist)
		insert into @rtn values(SUBSTRING(@string, 1, @index - 1)
	END
	ELSE
		insert into @rtn values(@string)
    return
end
how ever that was written on the fly and hasn't been tested
__________________
Definition of a Beginner, Someone who doesn't know the rules.

Definition of an Expert, Someone who knows when to ignore the rules.
Reply With Quote