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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Convert first character of a string to Upper Case

Status
Not open for further replies.

Bwintech

Programmer
Jan 25, 2002
25
0
0
GB
Hi,

I have a list of names and I want to run a script that will update the first character to be upper case, I have tried this but get an error:

update students
set substring(name,1,1) = UPPER(substring(name,1,1))

How else can I do this?

Many thanks for your help
 
Will this work? (untested)

update students
set name = UPPER(substring(name,1,1))
+ substring(name,2,LEN(NAME))
 
P.S.
Strictly speaking, I guess, we should actually subtract 1 from the overall length:

update students
set name = UPPER(substring(name,1,1))
+ substring(name,2,LEN(NAME) -1)

But I find it seems to works exactly the same without it.

rgrds, etc
bp
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top