Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
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: 358 | Views in the last 30 days: 3
 
Related Articles
FORUM

Stored procedure naming prefix

Question regarding naming prefix

FORUM

Prefixing table names with "tab"

Should table names be prefixed with "tab"

FORUM

Format File 9.0 Prefix Length

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

FORUM

Sql_Handle

Sql_Handle

FORUM

SQL Handle

SQL Handle

Tags
miscellaneous    
t-sql    
 
Contribute