Dashboard > Documentation for Metrix Developers and Consultants > ... > Troubleshooting Issues for Developers and Consultants > Converting All Caps Text to Proper Case
Documentation for Metrix Developers and Consultants Log In   View a printable version of the current page.
Converting All Caps Text to Proper Case
Added by Kim Snyder, last edited by Marquetta Drakes on Feb 06, 2007  (view change)

Converting text in all caps to proper case

The following is a stored procedure for a PROPERCASE function. Adding the stored procedure in the attached file Propercase.sql to your database will allow you to then use the function to covert text that has been formatted in all caps or all lower-case to proper intial/cap format.

You can generate the stored procedure using OSQL by following these directions: How to execute a .SQL script using OSQL Of course, we always recommend that you make a backup of your database before running SQL scripts. For instructions on creating a backup, please see Using OSQL to backup and restore a database

Once you have run this script, you will have a stored procedure PROPERCASE.

You can then use this stored procedure in update statement, such as this statement which would convert columns in tblContactLocations to proper case:

UPDATE tblContactLocations
SET City= dbo.PROPERCASE(City),
AddressLine1 = dbo.PROPERCASE(AddressLine1),
Addressline2 = dbo.PROPERCASE(AddressLine2),
Country = dbo.PROPERCASE(Country)

You can update as many columns as necessary using the same statement.

To run these scripts if you do not have SQL Server Enterprise Manager, you can write them using Notepad, save them as .sql files and run them in the same way that you ran the Propercase.sql file above.

Site powered by a free Open Source Project / Non-profit License (more) of Confluence - the Enterprise wiki.
Learn more or evaluate Confluence for your organisation.
Powered by Atlassian Confluence, the Enterprise Wiki. (Version: 2.1.1 Build:#406 Dec 23, 2005) - Bug/feature request - Contact Administrators