For those database developers coming from Oracle and migrating to SQL Server for
whatever reason, it is sometimes frustrating to know that some of the string
functions, or any functions for that matter, that you have come accustomed with
in Oracle is not available in SQL Server. One of these string functions
is the InitCap
function.

For those who are not familiar with this Oracle string function,
InitCap is a string function that changes the first letter of a
string to uppercase. The remaining letters are made lowercase.
InitCap(<cl>) takes a single argument, where cl is a character
string. This function returns cl with the first character of each word in
uppercase and all others in lowercase.

Here's a user-defined function that will simulate the behavior of the Oracle
InitCap string function.

Let's say you have a table containing book titles but the data as entered in the
table are all in uppercase and you want to set the titles capitalization
properly. Here's an example of your list of book titles:

As can be seen from the output, the first character in each word is converted to
uppercase while the rest of the characters of the word are all made to
lowercase. The same is the case for the word "CRM", as can be seen from
the book titles "A Practical Guide To Crm" and "Using Microsoft Crm".
Instead of maintaining it to all capital letters, it was changed to
"Crm". Since the user-defined function won't be able to know which words
need to be retained as all capital letters, these special cases have to be
handled manually.