Count Paragraphs in Text Fields

  • Thread starter Thread starter Alan Z. Scharf
  • Start date Start date
A

Alan Z. Scharf

Hi,

I would like to calculate the number of paragraphs in a field comprised of
text?

The data is in SQLServer and I have both RTF and plain text columns of the
same data.

The RTF column datatype is Text and the plain text column datatype is
VarChar.

Thanks.

Alan
 
Here is something you can try.
Create a make table query with PK field from your table and InStr Chr(13) of
the text field. This will create a record of where the first return is
located in the text.
Next create an append query using the orignal table and the table just
created joined on the PK. Append PK and InStr starting location Max
location of return list table plus 1.
Do this until no more returns are found. Then count records with location
greater than zero.

Hope you can follow this.
 
Karl,

Thanks for your reply. I guess I can also try that method in a loop for
each field in question.

Actually, I have 40 customer records with four different text fields each
in which I have to count the paragraphs.

I don't know whether it is possible to keep 'bumping through' these fields
in an overall SQL operation, or whther I will have to do it one field at a
time for each Customer.

I will give it a try.

Alan
 
Back
Top