returns @temp table([row] [int] IDENTITY(1,1) NOT NULL,valuess nvarchar(4000))
as
begin
declare @i int
set @str=rtrim(ltrim(@str))
set @i=charindex(@separtor,@str)
while @i>=1
begin
insert @temp values(left(@str,@i-1))
set @str=substring(@str,@i+1,len(@str)-@i)
set @i=charindex(@separtor,@str)
end
if @str<>''
insert @temp values(@str)
return
end
select * from dbo.func_split('1,2,3,4,5,7',',')