Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
Log in  ::  Register  ::  Not logged in

Get your favorite SSC scripts directly in SSMS with the free SQL Scripts addin. Search for scripts directly from SSMS, and instantly access any saved scripts in your SSC briefcase from the favorites tab.
Download now (direct download link)

Set Proper Name Case Function

By K2mission,

This script is basic in terms of how much it can handle. It sets the proper case in a "full name" field (i.e. First, Middle and Last names all in one column such as 'BILL MCDOUGLE' or 'terry smith-wenderling'. The function will take any case and set it appropriately including last names with the 'Mc' prefix.

There are some limitations.
1) It can't handle middle names if there is a last name prefix of 'Mc' such as 'McDougle'.
2) I haven't spent any additional time with other last name prefixes such as 'O' in "O'Brien" or 'Di' in 'DiNatale'
3) It is unable to handle bad data such as hyphens at the end of the string with only a single name.

Total article views: 352 | Views in the last 30 days: 6
Related Articles

Stored procedure naming prefix

Question regarding naming prefix


Prefixing table names with "tab"

Should table names be prefixed with "tab"


Format File 9.0 Prefix Length

How can I default prefix length to 0 for fixed width format file





SQL Handle

SQL Handle


Join the most active online SQL Server Community

SQL knowledge, delivered daily, free:

Email address:  

You make SSC a better place

As a member of SQLServerCentral, you get free access to loads of fresh content: thousands of articles and SQL scripts, a library of free eBooks, a weekly database news roundup, a great Q & A platform… And it’s our huge, buzzing community of SQL Server Professionals that makes it such a success.

Join us!

Steve Jones

Already a member? Jump in:

Email address:   Password:   Remember me: Forgotten your password?
Steve Jones