• Hugo Kornelis (7/13/2010)


    Both the text before the first delimiter and the text after the last delimiter will be a row, as each bit of text between two delimiters. That results in #rows = #delimiters + 1.

    You can see this in the WHERE clause:

    WHERE (...) = @StringDelimiter -- Twelve rows, for the twelve delimiters.

    OR Number - 1 = LEN(@Text) -- One row, for the end of the text.

    If the last character is a delimiter (that is, if the text had ended in a dot instead of a question mark), the number of rows would be equal to the number of delimiters, with the "last" row matching both of the OR'ed conditions.

    Hugo,

    thank you very much for your detailed explanation.

    In my mind, a sentence always ends with a dot; hence I was only looking at the left side of the delimiter. Just realized after my initial post that the last piece of text ended with a question mark; so the right hand side needs to be considered as well.

    Thanks again,

    Michael