June 17, 2003 at 9:18 am
is there a way to get the total amount of carriage returns for a given line? so i know how many lines i will be creating.
June 17, 2003 at 9:28 am
quote:
is there a way to get the total amount of carriage returns for a given line? so i know how many lines i will be creating.
not in one function, I guess.
You can use a loop with a combination of PATINDEX or CHARINDEX and increment a variable each time CHARINDEX returns a result > 0.
Cheers,
Frank
--
Frank Kalis
Microsoft SQL Server MVP
Webmaster: http://www.insidesql.org/blogs
My blog: http://www.insidesql.org/blogs/frankkalis/[/url]
June 17, 2003 at 9:46 am
You might try something like this:
declare @line varchar(1000)
set @line = 'line 1' + char(13) + 'line 2' + char(13) +
'line 3' + char(13) + 'line 4'
print @line
select len(@line) - len(replace(@line,char(13),'')) number_of_carriage_returns
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply