CREATE function SplitIn(@c varchar(200),@split varchar(2))
returns @t table(col varchar(20))
as
begin
while(charindex(@split,@c)<>0)
begin
insert @t(col)values (substring(@c,1,charindex(@split,@c)-1))
set @c=stuff(@c,1,charindex(@split,@c),'')
end
insert @t(col)values(@c)
return
end
原文连接:http://www.jb51.net/article/41472.htm