Search code examples
sqlsql-server-2008sql-server-2008-r2uppercasesentencecase

Convert upper case into sentence case


How do we convert Upper case text like this:

WITHIN THE FIELD OF LITERARY CRITICISM, "TEXT" ALSO REFERS TO THE ORIGINAL INFORMATION CONTENT OF A PARTICULAR PIECE OF WRITING; THAT IS, THE "TEXT" OF A WORK IS THAT PRIMAL SYMBOLIC ARRANGEMENT OF LETTERS AS ORIGINALLY COMPOSED, APART FROM LATER ALTERATIONS, DETERIORATION, COMMENTARY, TRANSLATIONS, PARATEXT, ETC. THEREFORE, WHEN LITERARY CRITICISM IS CONCERNED WITH THE DETERMINATION OF A "TEXT," IT IS CONCERNED WITH THE DISTINGUISHING OF THE ORIGINAL INFORMATION CONTENT FROM WHATEVER HAS BEEN ADDED TO OR SUBTRACTED FROM THAT CONTENT AS IT APPEARS IN A GIVEN TEXTUAL DOCUMENT (THAT IS, A PHYSICAL REPRESENTATION OF TEXT).

Into usual sentence case like this:

Within the field of literary criticism, "text" also refers to the original information content of a particular piece of writing; that is, the "text" of a work is that primal symbolic arrangement of letters as originally composed, apart from later alterations, deterioration, commentary, translations, paratext, etc. Therefore, when literary criticism is concerned with the determination of a "text," it is concerned with the distinguishing of the original information content from whatever has been added to or subtracted from that content as it appears in a given textual document (that is, a physical representation of text).


Solution

  • The base answer is just to use the LOWER() function.

    It's easy enough to separate the sentences by CHARINDEX()ing for the period (and then using UPPER() on the first letter of each sentence...).

    But even then, you'll end-up leaving proper names, acronyms, etc. in lower-case.

    Distinguishing proper names, etc. from the rest is beyond anything that can be done in TSQL. I've seen people attempt it in code using the dictionary from MS Word, etc...but even then, Word doesn't always get it right either.