Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Initcap function

Status
Not open for further replies.

PatelRam

Programmer
Aug 20, 2003
87
US
The initcap function sets the first character in each word to uppercase and
the rest to lowercase.

The syntax for the initcap function is:
initcap (string1)
string1 is the string argument whose first character in each word will
be converted to uppercase and all remaining characters converted to lowercase.

For example:

initcap ('tech on the net'); would return 'Tech On The Net'
initcap ('GEORGE BURNS'); would return 'George Burns'

I want to find out what is equivalent in DB2 ??????

How do I implement this in Db2 ...???


Thanks...
 
The following should work:

UCASE(SUBSTR('GEORGE BURNS',1,1))||LCASE(SUBSTR('GEORGE BURNS',2,(LENGTH('GEORGE BURNS')-1)))

Possibly create an UDF for it?

T. Blom
Information analyst
tbl@shimano-eu.com
 
Sorry, but T.Blom's answer will not work:
the result of his function probably will be:
"George burns" which is not wished.

Stephan
 
Yep, you are right of course.

Should have read the question better...






T. Blom
Information analyst
tbl@shimano-eu.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top