May 24, 2010 at 9:44 am
Kris there is a difference between a string which happens to have Carriage Returns, and splitting a string into rows;
search the script contributions for "Split", for a huge collection of different ways tosplit a string to rows;
here is just one example:
create function [dbo].[fn_split](
@str varchar(8000),
@spliter char(1)
)
returns @returnTable table (idx int primary key identity, item varchar(8000))
as
begin
declare @spliterIndex int
select @str = @str + @spliter
SELECT @str = @spliter + @str + @spliter
INSERT @returnTable
SELECT SUBSTRING(@str,N+1,CHARINDEX(@spliter,@str,N+1)-N-1)
FROM dbo.Tally
WHERE N < LEN(@str)
AND SUBSTRING(@str,N,1) = @spliter
ORDER BY N
return
end
Lowell
Viewing post 1 (of 2 total)
You must be logged in to reply to this topic. Login to reply