I have a column called description
with a datatype of varchar(MAX)
.
I would like to know how many paragraphs are in each description. How could I do this? I have tried:
select
len(description) - len(REPLACE(description, '\n', '')) as numParagraphs
but it keeps returning 0 paragraphs. Any advice?
I realized a way to do it...
select len(description) - len(replace(REPLACE(description, '.<br/>',
''),'. <br/>','')),
Not perfect due to spacing but almost there. For some reason our delimiters are <br/>
How to count paragraphs, you already know. You seem to be looking for possibilities of what constitutes a new paragraph, yet you don't want to or cannot examine your data in its natural output habitat.
Oh well, possibilities game started:
'\n'
'\r'
'\r\n'
'<br/>'
CHAR(13)
CHAR(10)
CHAR(13) + CHAR(10)