Often when I’m moving data around (usually with SSIS but also with just T-SQL), I need to take text that is all capitalized or simply has messed-up capitalization, and convert it to something that looks better (and more human readable) in the target system.
The most common option for me is conversion to Proper Case. Here’s an example. Let’s start with the following text:
On a webpage or report, that’s going to look downright ugly. In the March 2017 update to SDU_Tools, we added functions to do all of the above. SDU Tools is a free library for SQL Server developers and DBAs. You can easily just add it to your database, then call the functions as needed. The functions get added in a separate schema and are easy to remove later if you ever wish to. (We hope you won’t want to). They’re also easy to upgrade. You’ll find info here: http://www.sqldownunder.com/resources/sdutools
Let’s look at the output from the function:
The function has been built to allow for common capitalization rules in names and addresses. Here’s another example:
While Proper Case is useful, it’s not always what’s needed. Let’s look at the difference with a book title:
The key difference with Title Case is that minor words like “for”, “and”, “to”, etc. aren’t capitalized.
While we were adding these functions, we also decided to add a few other common ones. Snake case and Kebab Case look like this:
Note that in Snake Case, the words are all lower-cased and any whitespace between the words is replaced by a single underscore.
In Kebab Case, every word is capitalized and dashes (hyphens) are inserted between the words.
We hope you’ll find these functions useful. More details are here: