?
Solved

Correcting Capitalization in a table

Posted on 2004-04-09
6
Medium Priority
?
368 Views
Last Modified: 2012-08-13
I have a name database that has gotten a bit sloppy over time.  Some name enteries are all upper case, some are all lower case and others are correct.  My table is called master_name.  I am looking for a command to make the first character upper case and the rest lower.

update.dba.master_name
SET last_name??????????

How can I do this?
0
Comment
Question by:jkalkowski
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
6 Comments
 
LVL 3

Expert Comment

by:jayrod
ID: 10792674

update employee_master
set fname = char(ASCII(substring(fname, 1,1)) + 32) + substring(fname, 2, len(fname))

be extremely careful with this update statement... test everywhere first
0
 
LVL 3

Expert Comment

by:jayrod
ID: 10792687
whoops.. here is an easier one... that makes more sense


update employee_master
set fname = upper((substring(fname, 1,1))) + lower(substring(fname, 2, len(fname)))
0
 
LVL 3

Accepted Solution

by:
jayrod earned 200 total points
ID: 10792705
--Correction: took out extra parenthesis
update Table
set [column] = upper(substring([column], 1,1)) + lower(substring([column], 2, len([column])))
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 34

Expert Comment

by:arbert
ID: 10792741
Here's a UDF that we use to do the job:

http://vyaskn.tripod.com/code/propercase.txt


Just remember, any weird names like McHenry will usually be a problem....

Brett
0
 
LVL 3

Expert Comment

by:jayrod
ID: 10792799
thanks arbert.. I'll be using that UDF from now on if ya don't mind :)
0
 
LVL 1

Author Comment

by:jkalkowski
ID: 10792881
perfect jayrod....U just cut and pasted, changed the [column] to read lname and it worked great.  Also Brett, good point about those pesky Irish names :-)  Actually I found a few D'Angelo's that it will effect also but I'd rather have the majority look neat!

Thanks
0

Featured Post

Moving data to the cloud? Find out if you’re ready

Before moving to the cloud, it is important to carefully define your db needs, plan for the migration & understand prod. environment. This wp explains how to define what you need from a cloud provider, plan for the migration & what putting a cloud solution into practice entails.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

JSON is being used more and more, besides XML, and you surely wanted to parse the data out into SQL instead of doing it in some Javascript. The below function in SQL Server can do the job for you, returning a quick table with the parsed data.
For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…
Suggested Courses

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question