Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 SQL Server Administration (2005)
 Cleaning up data in tables for mail merge

Author  Topic 

NickC
Yak Posting Veteran

68 Posts

Posted - 2010-08-04 : 09:05:43
"There are a number of agents set up on the system where the address or their company name is typed incorrectly. If you take Address for example,. The first line of his address is:
HAMILTON & mCaULLEY - sTUART hAMILTON
As you will see the upper and lower case letters are all over the place in the wrong order. Its not just this agent, there are possibly hundreds like it as I have come across these when dealing with statements in the past as this is how any correspondence is headed. "

My manager asked em to do this, and im not really where to start im sure some VB function could do it if I imported into excel but wondeirng if theres some function within SQL which would do the following:

Capitalise only the first letter of each Sentence (or if not that then first letter of each word)

Remove any numbers or other unusual characters such as #~ etc

and white spaces (guess you could use l-trim and r-trim)

Thanks in advance ,

Nick :)

NickC
Yak Posting Veteran

68 Posts

Posted - 2010-08-05 : 08:13:32
I'm guessing no such luck :(
Go to Top of Page

kenchee
Starting Member

49 Posts

Posted - 2010-08-05 : 20:40:59
You can use the replace statements to remove all the unusual characters i.e replace(column_name,'#','')

As for capitalizing each letter of each word, check this page out http://www.sql-server-helper.com/functions/initcap.aspx


Hope this helps
Go to Top of Page
   

- Advertisement -